i just installed nginx 1.1.13 and php 5.4.0 on a centos 5.8 final 64bit machine. Nginx and PHP/Fpm are running, and I can run php scripts via ssh command line, but in the browser I keep getting 'File not found.' errors on all my PHP files.
This is how I have my nginx.conf handle PHP scripts:
location ~ \.php$
{
root /opt/nginx/html;
fastcgi_pass unix:/tmp/fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /opt/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
This is a direct copy/paste from my other servers, where it works fine with this setup (but they run older versions of php/fpm).
Why am I getting those errors?
Put "include fastcgi_params;" before all "fastcgi_param *" lines, "include fastcgi_params;" overrides all you "fastcgi_param *" lines (see nginx debug log):
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
andps 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.
I solve this problem by changing user and group tho the current user:group in php-fpm.d/www.conf
By default the user and group is 'nginx', change this....
Hope this helps