Wordpress + nginx infinite redirect loop

Solution 1:

Here is the problem:

        if (!-f $request_filename){
        rewrite ^/(.+)$ /index.php?$1& last;
        }

This is one of the most common nginx misconfigurations.

Replace these three lines with try_files:

try_files $uri $uri/ /index.php;

See also the WordPress wiki entry on nginx.

(BTW, your .htaccess does nothing, since you are not using Apache.)

Solution 2:

In the sites-enabled folder you will need to end the configuration for your site and add the multisite redirection rules. For Ubuntu 14.04 you will be able to find the path under /etc/nginx/sites-available

Add the following block in your server block and you should be able to avoid the infinite redirection loop.

#Rewrite multisite '.../wp-.*' and '.../*.php'.
if (!-e $request_filename) {
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
    rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}