nginx+php部署FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream错误

部署zabbix的lnmp环境时,测试php页面打不开,查看nginx的errorlog日志,报错FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream,

1、网上查询有修改nginx.conf的,如下

fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
修改为
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

然后执行service nginx reload 或者service nginx restart 或者进入/etc/init.d/nginx  restart

笔者是修改上面这个配置就解决了。

2、部分有说是php-fpm中user和group未指定nginx为其用户的。(我的配置里已提前指定过,所以排除这个原因,没配置的同学可以试试)

编辑php-fpm的配置
vi /usr/local/php/etc/php-fpm.conf 

大概在149行

 配置完检查进程ps -ef | grep php

原文地址:https://www.cnblogs.com/chxmtl/p/12617671.html