记一次Nginx报错Primary script unknown

查看Nginx的error.log错误日志信息发现

1
[error] 35#35: *28 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.10.160, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://192.168.10.30:9000", host: "192.168.10.30"

在Nginx的conf中找到定义脚本文件的地方:

1
fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

修改成如下方式($document_root):

1
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

$document_root 代表当前请求在root指令中指定的值:

1
2
3
4
5
location / {
root /usr/local/nginx/html;
index index.php index.html index.htm;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

上面配置中的$document_root就是针对/usr/local/nginx/html目录下的php文件进行解析。

博主QQ:1012405802
技术交流QQ群:830339411
版权声明:网站内容有原创和转载,如有侵权,请联系删除,谢谢!!
感谢打赏,93bok因你们而精彩!!(支付宝支持花呗)
0%