我在ubuntu 13.04上全新安装PHP5-fpm和Nginx时使用此配置:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/Nginx/html;
index index.PHP index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ /index.html;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
error_page 404 /404.html;
location ~ \.PHP${
fastcgi_split_path_info ^(.+\.PHP)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in PHP.ini
# With PHP5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With PHP5-fpm:
fastcgi_pass unix:/var/run/PHP5-fpm.sock;
fastcgi_index index.PHP;
include fastcgi_params;
}
}
最佳答案
原文链接:https://www.f2er.com/nginx/434660.html