系统相关
首页 > 系统相关> > Nginx-FastCGI-"Primary script unknown" while reading response header from upstream,

Nginx-FastCGI-"Primary script unknown" while reading response header from upstream,

作者:互联网

在对nginx添加fastCGI的支持后,然后进行php页面验证,居然报错File not found,查看日志显示

FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream,

一开始以为是权限问题,先上配置

location  ~ \.php$ {
          root  /data/nginx/html/php;
          default_type text/html;
          fastcgi_pass  127.0.0.1:9000;
          fastcgi_index  index.php;
          #fastcgi_param  SCRIPT_FILENAME /data/nginx/php$fastcgi_script_name;
          fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;   //有问题的一行
          fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
          include  fastcgi_params;
       }

看起来配置是一样的,其实这里有个天坑,我是直接复制win到linux的,,使用nginx -t文件是OK的,完全检测不出来,令人摸不到头绪,可以下载WinMerge文件对比一下上下两行,也可以cat -A检测win空格。

 

标签:header,unknown,script,param,FILENAME,nginx,php,fastcgi
来源: https://www.cnblogs.com/rtnb/p/15860088.html