FastCGI sent in stderr: "Primary script unknown" while reading response header from upstre
Posted 王默
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了FastCGI sent in stderr: "Primary script unknown" while reading response header from upstre相关的知识,希望对你有一定的参考价值。
在对nginx添加fastCGI的支持后,然后进行php页面验证,发现页面识别不到,不清楚什么情况,随后google了下,原来是Nginx内置变量问题惹的祸。
1、平台介绍:
1
2
3
4
5
6
|
OS Version: CentOS release 6.4 (Final) Nginx Version: nginx version: nginx/ 1.4 . 3 PHP Version: PHP 5.5 . 5 (fpm-fcgi) Kernel Version: 2.6 . 32 - 358 .el6.x86_64 IP address: 192.168 . 168.133 |
1
|
|
2、报错信息:
1
|
2013/10/22 20:05:49 [error] 12691#0: *6 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.168.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.168.133" |
3、错误原因及解决方法:
主配置文件第69行定义调用脚本文件路径:
1
|
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; |
而Nginx识别不到/scripts路径,所以phpinfo验证信息就无法正常通过,需要修改如下:
1
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
Note:
$document_root 代表当前请求在root指令中指定的值。
我们这里为系统默认,
1
2
3
4
|
所以该语句就是针对/usr/local/nginx/html目录下的php文件进行解析。
然后再次进行页面查看已经ok.
参考文章:
以上是关于FastCGI sent in stderr: "Primary script unknown" while reading response header from upstre的主要内容,如果未能解决你的问题,请参考以下文章
FastCGI sent in stderr: "Unable to open primary script:index.php (Operation not permitted) 问题解
Nginx 错误 FastCGI 在 stderr 中发送:“访问脚本 [文件夹] 已被拒绝(请参阅 security.limit_extensions)”
修复Nginx报错:upstream sent too big header while reading response header from upstream