WordPress on Apache being Reverse Proxied by Nginx in an Endless Loop

· 92 Words

I have a couple of WordPress installations running on Apache (on a non-80) port, and I’m reverse proxying them through nginx. Somewhere along the line WordPress is getting its knickers in a twist about the port not being the same as it expects. This results in WordPress going into an infinite redirect loop.

To solve this, I put this in the nginx virtual server config:

proxy_set_header Host $host;


Here’s my whole config. At least the relevant bit.

server_name  my-wordpress-site.com;

location / {
proxy_pass         http://my-wordpress-site.com:8080/;
proxy_set_header  X-Real-IP  $remote_addr;

Read more