在对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)
Mysql Version:     Server version: 5.6.10-log Source distribution
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
location / {
       root   /usr/local/nginx/html;
       index  index.php index.html index.htm;
        }

所以该语句就是针对/usr/local/nginx/html目录下的php文件进行解析。

然后再次进行页面查看已经ok.

参考文章:

FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream,的更多相关文章

  1. 【nginx】 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream

    2013/10/22 20:05:49 [error] 12691#0: *6 FastCGI sent in stderr: "Primary script unknown" w ...

  2. Nginx+PHP配置错误,日志:[error] 24324#0: *31 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream

    一.问题现象 1.安装nginx.php.php-fpm后,浏览器访问php报错,“File not found”: 二.问题排查 1.检查nginx.php-fpm服务是否正常启动,均正常启动: 2 ...

  3. [error] 1507#0: *22 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 10.0.0.1, server: www.wordpress.com, request: "GET /info.p

    字体比较小,如果你遇到这个问题请仔细的把下面的总结看完. 环境:CentOS6.7.2.6.32-573.el6.x86_64.nginx1.12.2 .php5.5.38 问题:nginx能解析静态 ...

  4. 解决nginx FastCGI sent in stderr: “Primary script unknown”

    今天重启了mac,突然发现本地的 lnmp 服务不能用了,什么请求都返回了: FastCGI sent in stderr: "Primary script unknown" 这个 ...

  5. NGINX+PHP-FPM7 FastCGI sent in stderr: “Primary script unknown”

    https://www.cnblogs.com/hjqjk/p/5651275.html 一开始是Nginx打开网页显示一直是拒绝访问.查看nginx日志是报错显示我的题目,然后就各种搜索解决啊! 百 ...

  6. *2 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected '[' in /application/nginx-1.6.3/html/zabbix/index.php on line 32" while reading response header from upstream, clien

    今天呢想学习一下zabbix监控一下我的服务情况,然后就开始安装我的zabbix服务,首先LNMP环境准备好了,Nginx版本为1.6.3,php版本为5.3.27,MySQL版本为二进制包安装的5. ...

  7. nginx FastCGI错误Primary script unknown解决办法

    在centos上成功编译安装nginx 1.4.php 5.4并成功启动nginx和php-fpm后,访问php提示"File not found.",同时在错误日志中看到: 复制 ...

  8. PHP Primary script unknown 终极解决方法

    相信很多配置php环境的都遇到过这个恼人的问题: 浏览器访问php文件,返回来 File not found 查看/var/log/nginx/error.log ,有 “Primary script ...

  9. Nginx-Primary script unknown的报错的解决方法

    配置nginx时一直报错:file not found 错误日志: [error] 12691#0: *6 FastCGI sent in stderr: "Primary script u ...

随机推荐

  1. idea之常见问题解决

    在启动类中的main方式时报类似java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest异常 解决方案:

  2. stage1----航空票务系统需求分析报告

    航空票务管理系统需求分析报告 题    目    航空票务管理系统需求分析报告 学    院       信息科学与工程学院 专    业        计算机科学与技术 组    员         ...

  3. springboot整合ActiveMQ1(基本使用)

    基本使用,https://www.tapme.top/blog/detail/2018-09-05-10-38 主备模式,https://www.tapme.top/blog/detail/2018- ...

  4. Hive的五个基础介绍

    一.什么是Hive? 1.Hive是一个翻译器,SQL ---> Hive引擎 ---> MR程序 2.Hive是构建在HDFS上的一个数据仓库(Data Warehouse) Hive ...

  5. css设置图片百分比显示,最简洁的代码

    css代码: .img-box { padding-bottom: 100%; } .img-box img { position: absolute; top:; bottom:; left:; r ...

  6. ceph 剔除osd

    先将osd.2移出集群 root@ceph-monster:~# ceph osd out osd.2 marked out osd.2. root@ceph-monster:~# ceph osd ...

  7. IIS-This configuration section cannot be used at this path.

    Q:在IIS上部署web后,游览器打开报以下异常: This configuration section cannot be used at this path. This happens when ...

  8. Java8 stream用法-备忘录

    1. 如何使用匹配模式 List<String> strs = Arrays.asList("a", "a", "a", &qu ...

  9. 时间模块time和datetime的使用

    日期和时间 一 time模块 import time 时间的表示形式: 时间戳 时间戳是指格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现 ...

  10. mysqldump 备份与恢复数据库

    备份数据库 mysqldump -u root -plvtao test > /home/bak.sql 数据库还原,常用source 命令登陆 mysql -u root -p mysql&g ...