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空格。

 

posted @   不会跳舞的胖子  阅读(544)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 使用C#创建一个MCP客户端
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示