Nginx proxy for apache2 guide, mod_rewrite not working

Posted June 21, 2013 6.7k views
The guide followed was here: I've setup everything and modified some other stuff to my liking, however as stated by another user, a fresh Wordpress install gives a redirect loop error on the index page. The dashboard works fine. To get around that error, I had to add remove_filter('template_redirect', 'redirect_canonical'); to the theme's functions.php file. Now I try to enable friendly urls with the .htaccess and it doesn;t work, it just reloads the same page no matter what I click. Is there something I'm missing? My Nginx server block: My Apache vhost: Any help is appreciated.

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.

Submit an Answer
2 answers
Fixed the issue myself.

New Nginx config:

Your try_files changes the URL to /index.php in order to send it upstream which looses the pretty permalink.

You might try to send the pretty permalink upstream by adding a named location. Maybe:

location / {
try_files $uri $uri/ @proxy;

location @proxy {
proxysetheader X-Real-IP $remoteaddr;
setheader X-Forwarded-For $remoteaddr;
proxysetheader Host $host;
location ~ .php$ {
setheader X-Real-IP $remoteaddr;
proxysetheader X-Forwarded-For $remoteaddr;
setheader Host $host;