NGINX + Wordpress gives ERR_TOO_MANY_REDIRECTS

admin

Administrator
Staff member
I have been trying to host a simple Wordpress blog using NGINX as the web-server. The blog is hosted as a subdirectory under domain_name.com/blog.

The main blog opens up correctly. But when trying to open the wp-admin under domain_name.com/blog/wp-admin my browser shows ERR_TOO_MANY_REDIRECTS.

I am not sure if this is an issue with my NGINX configuration or wordpress configuration. Following is my NGINX server block:

Code:
server {
  listen 80;
  server_name <domain_name.com>;
  root /var/www/html;
  index index.php;

  location /blog {
    try_files $uri $uri/ /blog/index.php?$args;
  }

  location ~ \.php$ {
    include fastcgi.conf;
    fastcgi_intercept_errors on;
    fastcgi_pass php;
  }

  location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires max;
    log_not_found off;
  }
}

Wordpress is installed under the /var/www/html/blog directory. And the values for "siteurl" and "home" wp_options in the database are both pointing to domain_name.com/blog.

What would be a good way to solve this problem?

Additional notes that might be helpful:
When I try to access static files under the wp-content directory, they open without any issues. No redirection errors there.