nginx + php-fpm 访问php提示File not found.

检查虚拟主机配置中的:

1
2
3
4
5
6
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME html$fastcgi_script_name;
include fastcgi.conf;
}

看下最后的include的文件是否存在,因为不同的版本这个文件的名字可能不同,所以只看网上的教程可能会照不到这个文件. 比如我本地的是fastcgi.conf,而VPS是fcgi.conf,所以这里一定要注意了.