Wednesday, 7 August 2013

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

I'm setting up my blog on a new EC2 instance because one of the sites on
the server that's currently hosting it is being DDoSed. I'm having some
trouble with nginx, because I can either see all the pages fine but 403 on
the index, or see the index but 404 on the pages (depending on the config
I'm using)
Here's my nginx config:
server {
listen 80;
server_name www.test.com;
server_name test.com;
root /www/blog;
include conf.d/wordpress/simple.conf;
}
And simple.conf:
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't
break when using query string
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
if I change the try_files $uri $uri/ /index.php?$args; to index index.php,
the front page will work fine and the rest will be 404. If I leave it like
that, the front page is 403.
Is there anything obvious I'm doing wrong ?
Thanks !

No comments:

Post a Comment