403 forbidden on wordpress index with nginx, the rest of the pages work fine 403 forbidden on wordpress index with nginx, the rest of the pages work fine wordpress wordpress

403 forbidden on wordpress index with nginx, the rest of the pages work fine


Add index index.php; In the server block, if it doesn't work then you need to remove the $uri/ because you don't want to do a autoindex on


EDIT: Just noticed that you already figured out your problem, so I'll add the reasoning behind it, the reason why you needed autoindex on; is because without it nginx will follow the try_files rules,

  1. Check if there's a file called /, and of course it fails.
  2. Check if there's a directory called / (by adding root it would = /www/blog/), this check will succeed, so it tries to list the content of the folder.
  3. Since you didn't specify autoindex on; so by default nginx should forbid directory listing, thus it would return a 403 forbidden error.
  4. The rest of the site works fine because it fails the $uri/ test or doesn't reach it, because you probably don't have a folder called image.jpg or stylesheet.css etc.


Looks like I needed the inded index.php in the server {} definition and not in the location {}


It seems that you are not allowing arguments to be sent to the CMS so this will not show this uris that would bring information from the database and redirect you to the 403 page.