使用nginx web服務器和php。 nginx正在工作,我看到'歡迎來到nginx!'但是當我嘗試訪問一個php頁面時,我得到了'拒絕訪問'。我也安裝了php-fastcgi。在nginx和php上拒絕訪問
這裏是我的nginx的默認的conf:
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
我/etc/php5/fpm/php.ini
活化狀態在/etc/php-fpm.d/www.confsecurity.limit_extensions = .php .php3 .php4 .php5 .html
和
listen = /var/run/php5-fpm.sock
和
cgi.fix_pathinfo = 0
我重新啓動了nginx和php5-fpm。
感謝您的幫助。
太棒了!這就是訣竅!謝謝! – raice