linuxserver.io

[Support] Linuxserver.io - Nginx

115 posts in this topic Last Reply

Recommended Posts

Hi, 

 

Someone able to help me?

See message above.

 

Br,

Johannes

Share this post


Link to post
On 2.2.2018 at 8:43 AM, ebnerjoh said:

Hello,

 

I have a special question regarding the dockers "nginx" and "letsencrypt".

 

Currently I have the following setup:

 

1) LetsEncrypt as ReverseProxy

2) Apps behind ReverseProxy, e.g. NextCloud and Apache

 

I noticed now that the Apache-Docker has a very outdated PHP Version (5.9) so I want to change this. I havent found a newer Apache Docker so the question is now:

 

A) Should I but my Webpages I have currently on Apache onto the LetsEncrpyt-Docker?

B) Or should I forward from the LetsEncrpyt-Docker to the NGINX-Docker (like I do now with Apache)?

 

And then another question: I need a simple site-conf-example for a Joomla Website for nginx. It only needs to listen on a special HTTPS Port, not on HTTP.

 

Br,

Johannes

 

Is no one out there who could answer my questions?

 

Br

Johannes

Share this post


Link to post
4 hours ago, ebnerjoh said:

 

Is no one out there who could answer my questions?

 

Br

Johannes

 

Apache vs nginx is totally up to you. We currently don't have plans of updating the apache container so you can try moving it over to nginx and see if it works. 

 

With regards to Joomla, not sure as I haven't tried it. But I do run wordpress and it works fine

Share this post


Link to post
1 hour ago, aptalca said:

 

Apache vs nginx is totally up to you. We currently don't have plans of updating the apache container so you can try moving it over to nginx and see if it works. 

 

With regards to Joomla, not sure as I haven't tried it. But I do run wordpress and it works fine

 

Hi, do you have an example sites.conf for NGINX for me?

 

Br,

Johannes

Share this post


Link to post
4 hours ago, ebnerjoh said:

 

Hi, do you have an example sites.conf for NGINX for me?

 

Br,

Johannes

 

For wordpress? 

Share this post


Link to post
6 hours ago, aptalca said:

 

For wordpress? 

 

Also interested. I'm stuck right now trying to get a site to work that is running through cloudflare > nginx > apache-php (docker) > wordpress install. If I could just axe having to run apache docker that would be great. Does nginx have builtin php support? 

Share this post


Link to post
4 hours ago, neebski said:

 

Also interested. I'm stuck right now trying to get a site to work that is running through cloudflare > nginx > apache-php (docker) > wordpress install. If I could just axe having to run apache docker that would be great. Does nginx have builtin php support? 

 

Yes, it has php7. 

 

I'll post my config tomorrow

Share this post


Link to post
15 hours ago, aptalca said:

I'll post my config tomorrow

 

Great, thank you!

Share this post


Link to post

Ok, so I looked through my nginx config for wordpress. For a basic install, I literally just dropped the wordpress install files into the www folder created the database in a separate mariadb container, and browsed to the wp-admin/install.php to install. That was it. Initially, I didn't have to change anything in the nginx/wordpress site config.

 

For reverse proxy through a separate letsencrypt/nginx container, I added the following:

 

letsencrypt site config:

        location / {
                proxy_pass http://127.0.0.1:81/;
                proxy_read_timeout    90;
                proxy_connect_timeout 90;
                proxy_redirect        off;

                proxy_set_header      X-Real-IP $remote_addr;
                proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header      X-Forwarded-Proto https;
                proxy_set_header      X-Forwarded-Port 443;
                proxy_set_header      Host $host;
        }

and add the following to wordpress wp-config.php:

if ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) ||
     (!empty( $_SERVER['HTTP_X_FORWARDED_FOR'])) ) {
    $_SERVER['HTTPS'] = 'on';
}

 

In the first one, change the http://127.0.0.1:81/ to your unraid ip and nginx/wordpress http port.

 

The second one makes sure that wordpress serves https over the http port.

 

Then in the wordpress gui (accessing locally through the unraid ip and nginx port) login to the admin interface, go to settings and change the server address to your custom domain address so wordpress redirects all requests to that external address.

 

That was it

 

For pretty permalinks, I had to add this to the nginx/wordpress container's site-config:

        if (!-e $request_filename) {
                rewrite ^.*$ /index.php last;
        }

Later on, you may want to change some settings in the php.ini for certain . Currently there is no easy way, but we have a PR in process that will make it super easy. It should be merged within a week or two.

Edited by aptalca

Share this post


Link to post

@aptalca Most of your suggestions worked as intended, although I have a few issues when attempting to login to the WP install. Do you mind if I PM you about this?

Share this post


Link to post
2 hours ago, neebski said:

@aptalca Most of your suggestions worked as intended, although I have a few issues when attempting to login to the WP install. Do you mind if I PM you about this?

 

Sure

Share this post


Link to post

Could someone share a complete nginx conf file for me PLEASE

 

I was happy with Apache docker but it stopped working and wont be fixed so I have to move to nginx. 

 

I reverse proxy etc all my dockers so as busy a config as poss please

 

Deluge, Sabnzbd, Sonarr, Radarr, Mylar, Headphones, LazyLibrarian, Ubooquity, Jackett, NZBhydra

 

All sat behind my webserver in the good old Apache days 😞

Share this post


Link to post
Posted (edited)
7 hours ago, methanoid said:

Could someone share a complete nginx conf file for me PLEASE

 

I was happy with Apache docker but it stopped working and wont be fixed so I have to move to nginx. 

 

I reverse proxy etc all my dockers so as busy a config as poss please

 

Deluge, Sabnzbd, Sonarr, Radarr, Mylar, Headphones, LazyLibrarian, Ubooquity, Jackett, NZBhydra

 

All sat behind my webserver in the good old Apache days 😞

 

If you do RP, you should use our letsencrypt container. Check the Readme to enable RP for some of the applications in your list. 

Edited by saarg

Share this post


Link to post
22 hours ago, saarg said:

 

If you do RP, you should use our letsencrypt container. Check the Readme to enable RP for some of the applications in your list. 

 

Went to the LetsEncrypt support thread to read someone saying "Dont use this if all you need is to use Nginx"... which is probably all I need... Dont think I need certs. Just access to see an example FULL conf where someone has used RP.... 😞

Share this post


Link to post
1 hour ago, methanoid said:

 

Went to the LetsEncrypt support thread to read someone saying "Dont use this if all you need is to use Nginx"... which is probably all I need... Dont think I need certs. Just access to see an example FULL conf where someone has used RP.... 😞

 

This nginx image is meant to be mainly a webserver, whereas the letsencrypt one is meant for reverse proxy. It doesn't mean that you can't use nginx for reverse proxy, it's just that the default site config of the letsencrypt image has some bits that makes reverse proxy much easier. 

 

For instance the letsencrypt image has a file called proxy.conf https://github.com/linuxserver/docker-letsencrypt/blob/master/root/defaults/proxy.conf

Feel free to drop that into the nginx folder in this container and include it in the site config for proxies. 

 

Also, the letsencrypt container has a folder full of preset reverse proxy configs here: https://github.com/linuxserver/docker-letsencrypt/blob/master/root/defaults/proxy.conf

 

Also check out the two reverse proxy examples in the letsencrypt default site config: https://github.com/linuxserver/docker-letsencrypt/blob/master/root/defaults/default

 

This should set you on the right path

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Copyright © 2005-2018 Lime Technology, Inc.
unRAID® is a registered trademark of Lime Technology, Inc.