这个错误很常见,很明显找不到文件。php
缘由是php-fpm找不到SCRIPT_FILENAME里执行的php文件,因此返回给nginx 404 错误。html
那么两种状况要么文件真的不存在,要么就是路径错误。nginx
location / { root /var/www/example.com; index index.html index.htm index.pl; }
若是配置文件这样的,那么明显很差,也就是在面试
location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME #document_root$fastcgi_script_name; include fastcgi_params; }
这里的document就找不到document_root,因此能够把root放在location外面试试看或者在php-fpm
location ~ \.php$ {}
里面加上root.spa
若是文件真的不存在的话,由于nginx检查$uri是否是.php结尾,不检查是否是存在,因此找不到时候就返回404错误。“No input file specified”htm
若是是这样的话,在配置文件种用try_files就能够检查是否存在了。blog
不存在就返回404.ip
location ~ .php$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; ... }