Nginx Access PHP files file not found error handling, two cases
This error is common, there are two of the following
1. PHP-FPM could not find PHP files executed in Script_filename
2. PHP-FPM cannot access the PHP that is being executed, that is, the permissions issue
First case
It can be added to your location PHP to return 404 when the file does not exist, instead of handing it over to PHP-FPM.
Location ~ \.php$
{
...
#文件不存在转404
Try_files$uri = 404;
...
}
Then, in your configuration file, find the following paragraph
Fastcgi_param Script_filename/scripts$fastcgi_script_name;
Replace with the following Fastcgi_param script_filename $document _root$fastcgi_script_name;
Then reload the Nginx configuration file
Systemctl Restart Nginx
The second case
Two workarounds:
The first is to set your root folder to be allowed by other users
Second, find your php-fpm configuration file, find the following section, and replace Apache with the user group you want
; Rpm:apache choosed to being able to access some dir as httpd
user = Apache
; Rpm:keep a group allowed to write in log dir.
Group = Apache
Nginx Access PHP files file not found error handling, two cases