环境:
CentOS release 6.10 (Final)
PHP 7.0.1
mysql5.7.26
配置完成后,访问静态页面正常;
但是访问PHP文件,都是提示file not found;
查看日志是提示:
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream
网上搜了一圈,都是让修改 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name为fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
修改php-fpm的配置文件用户和用户组,都没有解决问题;
后来把fastcgi_param SCRIPT_FILENAME这行改成:fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name;测试正常

转自:https://blog.csdn.net/weixin_34043301/article/details/92657023