When you encounter this problem, first confirm that you are in the Web server configuration. PHP is not assigned to FASTCGI server processing:
Location ~ . php$ { 127.0. 0.1:9000;}
If configured, it may be caused by an incorrect path to the Fastcgi_script_name access script.
Especially with subdirectories, for example, for YII frameworks, the path is usually project/web
Then if you access/project/index.php in the URL, then the script_name in the Nginx configuration will be the full path: project/index.php
If the code in your configuration is as follows:
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Then the actual access to the file is/var/site_root/project/web/project/index.php, which is obviously not the result we want, we want to visit is/project/web/index.php.
These errors can be traced by looking at the Php-fpm.log (error log).
The workaround is to modify the appropriate path configuration.
Note: Multiple sites use subdirectory configuration to refer to:
https://rtcamp.com/wordpress-nginx/tutorials/multisite/subdirectories/in-a-subdirectory/
NGINX/PHP-FPM access to PHP files without running the direct download