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.




Php Fpm