我在一個新的EC2實例上設置我的博客,因爲當前託管它的服務器上的一個站點正在被DDoSed。 我在nginx上遇到了一些麻煩,因爲我可以在索引上看到所有的頁面,但在索引上看到403,或者在頁面上看到索引,但看到404(取決於我使用的配置)403用nginx禁用wordpress索引時,其餘頁面正常工作
這是我的nginx的配置:
server {
listen 80;
server_name www.test.com;
server_name test.com;
root /www/blog;
include conf.d/wordpress/simple.conf;
}
而且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;
}
如果我改變try_files $ URI $ URI//index.php?$args;以指數的index.php,頭版將正常工作,其餘的將是404。如果我離開它這樣,頭版是403
這裏的錯誤日誌:
2013/08/07 19:19:41 [error] 25333#0: *1 directory index of "/www/blog/" is forbidden, client: 64.129.X.X, server: test.com, request: "GET/HTTP/1.1", host: "www.test.com"
那nginx用戶目錄爲755:
drwxr-xr-x 6 nginx nginx 4096 Aug 7 18:42 blog
有沒有什麼明顯的我做錯了?
謝謝!
不知道你的意思是有什麼,我通過?$ args發送參數? –