关于搭建LEMP环境的一点疑问
程序员文章站
2022-05-09 07:53:17
...
在ubuntu 12.04版本下搭建LEMP环境,参照网上教程配置一步步下来,发现访问index.php一直报404 NOT FOUND 的错误(如果将文件名改回index.html则可以正常访问),请问该如何解决?
php相关配置文件中已经设置了cgi.fix_pathinfo=0和listen = /var/run/php5-fpm.sock
nginx配置信息如下:
php相关配置文件中已经设置了cgi.fix_pathinfo=0和listen = /var/run/php5-fpm.sock
nginx配置信息如下:
server {
listen 80;
root /vagrant/www/;
index index.php index.html index.htm;
server_name localhost;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}