Question

Wordpress on Synology NAS with Nginx reverse proxy - Redirect Loop

Hello, I am troubleshooting this for a long time now, but I can’t find a solution by myself - hope you can help me. I installed the Wordpress package on my Synology NAS, which serves Wordpress on http://192.168.0.101/wordpress

Now I want to access the site from the internet - therefore I set up a reverse proxy with Nginx - I use this proxy for some internal sites, everything works except Wordpress, where it ends either in an redirect loop, or a “page not found” Wordpress site.

Wordpress is hosted on the Synology Nas with no SSL, because I want that the SSL encryption is served by the reverse proxy, so that I don’t need to install the certificate on the Synology Nas.

I already tried to disable Wordpress redirecting with remove_filter(‘template_redirect’,‘redirect_canonical’); in the theme functions.php, but no success.

Thank you in advance for your much appreciated help!

My Wordpress website address is set to: https://blog.mydomain.com/wordpress

My Nginx config for this subdomain part:

server {
	listen 443 ssl http2;
	listen [::]:443 ssl http2;
	index index.php;
	server_name blog.mydomain.com;

	# reverse proxy
	location / {
		proxy_pass http://192.168.0.101/wordpress/;
		include nginxconfig.io/proxy.conf;
	}

	# SSL
	ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;
	ssl_trusted_certificate /etc/letsencrypt/live/mydomain.com/chain.pem;

	proxy_ssl_session_reuse on;
	proxy_ssl_verify       on;
}

#Forward HTTP to HTTPS

server {
   listen 80;
   listen [::]:80;
   server_name blog.mydomain.com;
   return 301 https://$server_name$request_uri;

}

NGINXCONFIG.IO proxy.conf

proxy_http_version	1.1;
proxy_cache_bypass	$http_upgrade;

proxy_set_header Upgrade			$http_upgrade;
proxy_set_header Connection 		"upgrade";
proxy_set_header Host				$host;
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	$scheme;
proxy_set_header X-Forwarded-Host	$host;
proxy_set_header X-Forwarded-Port	$server_port;
Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

If you visit http://192.168.0.101/wordpress via your local network, does it work as expected?

If so, try updating the config a little bit to match your site and home URLs in your WordPress installation:

    # reverse proxy
    location /wordpress {
        proxy_pass http://192.168.0.101/wordpress/;
        include nginxconfig.io/proxy.conf;
    }

Let me know how it goes! Bobby