Nginx/FPM/PHP all php files say 'File not found.'
Put "include fastcgi_params;" before all "fastcgi_param *" lines, "include fastcgi_params;" overrides all you "fastcgi_param *" lines (see nginx debug log):
location ~ \.php$ {
root /opt/nginx/html;
fastcgi_pass unix:/tmp/fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /opt/nginx/html$fastcgi_script_name;
}
I had the same issue.
What I did to solve this was to check the user running nginx, php-fpm and check their permissions for accessing the folder where the root is. It is be default 'www-data'.
but you can find out by using the ps aux | grep php-fpm
and ps aux | grep nginx
commands.
You have to make sure the folder is accessible to the user running these processes.
I had the same issue, and for me it was a misconfigure/non-existing "root" directive in the nginx server config
I use such configuration, wish it could help you. It works in OS X. As for me, @Xosofox 's answer worked. I mistyped the version of nginx 1.6.2 as 1.2.6, so that the root became a non-existing directory.
location ~ \.php$ {
fastcgi_intercept_errors on;
root /usr/local/Cellar/nginx/1.6.2/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/local/Cellar/nginx/1.6.2/html$fastcgi_script_name;
}