解决nginx FastCGI sent in stderr: “Primary script unknown”
今天重启了mac,突然发现本地的 lnmp 服务不能用了,什么请求都返回了:
FastCGI sent in stderr: “Primary script unknown”
这个就很尴尬了,可是我啥也没动啊,但是没有办法,出问题了就得查,google了一下,出这个问题一般有两个原因:
一是nginx的配置文件问题
即 /usr/local/etc/nginx/nginx.conf (个人的,你们的路径不一定是这个)中的 fastcgi_param 参数配置问题,nginx默认配置为:
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
但是,如果你在nginx.conf 中设置了设置你本地的 root 目录(服务根目录),例如:
root /var/www/console/frontend/www/;
那么需要将 fastcgi_param 参数修改为:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
配置完成后,尝试重启 nginx 和 php-fpm, 看下服务是否恢复了,如果没有恢复,请接着往下看:
第二个原因是:php-fpm.conf 中设置了错误的用户和组别
默认的php-fpm.conf 中会 include 这个一个文件夹(可能会不同):
include=/usr/local/etc/php/7.1/php-fpm.d/*.conf
意思是把 php-fpm.d 文件夹下面的所有 .conf 结尾的文件都 include 进来,一般情况下,会在这些 .conf 文件中配置 user/group
进行到这里,你可以执行一下下面这条命令,看下你目前的 php-fpm 是用什么身份运行的:
ps aux | grep -v root | grep php-fpm | cut -d\ -f1 | sort | uniq
特别的,在OS X 系统下,用户应该是 :
user = [your username]
group = staff
如果发现用户不对,比如,你的身份是 admin ,但是上面命令的执行结果却是 nobody,那么你需要将 php-fpm.d 文件夹(或者其他文件夹,或者直接在 php-fpm.conf 中进行设置,视个人情况而定)下的 user 修改为你当前的身份,同样的,修改完成后重启 nginx 和 php-fpm 看下是否正常
如果还是不正常,那么请参考下其他的解决方案,不过大部分情况,上面两种case 应该都包含进去了。
解决nginx FastCGI sent in stderr: “Primary script unknown”的更多相关文章
- 【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 ...
- 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 ...
- FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream,
在对nginx添加fastCGI的支持后,然后进行php页面验证,发现页面识别不到,不清楚什么情况,随后google了下,原来是Nginx内置变量问题惹的祸. 1.平台介绍: 1 2 3 4 5 6 ...
- [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能解析静态 ...
- NGINX+PHP-FPM7 FastCGI sent in stderr: “Primary script unknown”
https://www.cnblogs.com/hjqjk/p/5651275.html 一开始是Nginx打开网页显示一直是拒绝访问.查看nginx日志是报错显示我的题目,然后就各种搜索解决啊! 百 ...
- nginx FastCGI错误Primary script unknown解决办法
在centos上成功编译安装nginx 1.4.php 5.4并成功启动nginx和php-fpm后,访问php提示"File not found.",同时在错误日志中看到: 复制 ...
- Nginx-Primary script unknown的报错的解决方法
配置nginx时一直报错:file not found 错误日志: [error] 12691#0: *6 FastCGI sent in stderr: "Primary script u ...
- nginx+php-fpm 报错Primary script unknown
报错信息(nginx日志): // :: [crit] #: * stat() : Permission denied), client: 172.21.205.25, server: localho ...
- PHP Primary script unknown 终极解决方法
相信很多配置php环境的都遇到过这个恼人的问题: 浏览器访问php文件,返回来 File not found 查看/var/log/nginx/error.log ,有 “Primary script ...
随机推荐
- hadoop环境中误删除tmp文件夹的恢复
情景描述: 种种原因,不小心把系统根目录中的tmp文件删除了!发现jps之后看不到 master主机上面的namenode,resourcemanager,secondarynamenode三个进程了 ...
- css 的包含块 、负外边距,字体,文本行高
一.包含块 目的:确定元素的位置和相对大小(%) 1.正常文档流元素和浮动元素 ---- 父元素的 content-box 2.绝对定位元素 ---- 父元素的 padding-box 3.固定定位元 ...
- 连接池报错 Proxool Provider unable to load JAXP configurator file: proxool.xml
上篇博文讲到简易配置 proxool 连接池:http://www.cnblogs.com/linnuo/p/7232380.html 由于把说明注释留在了 proxool.xml 配置文件里导致配置 ...
- yii2 队列 shmilyzxt/yii2-queue 简介
在yii2论坛中看到一个关于队列的帖子,感觉不错.http://www.yiichina.com/extension/1084 (注:SendMail 错写为 SendMial,粘贴时要注意了.) 在 ...
- 【bzoj1458】士兵占领
Description 有一个M * N的棋盘,有的格子是障碍.现在你要选择一些格子来放置一些士兵,一个格子里最多可以放置一个士兵,障碍格里不能放置士兵.我们称这些士兵占领了整个棋盘当满足第i行至少放 ...
- iOS多款源码分享
iOS精选源码 列表联动,Linkage 电商商品详情 AxcUIKit-控件整合框架,快速简单的使用高级控件 GKNavigationBarViewController-导航栏联动 仿京东的加入购物 ...
- 51. leetcode 530. Minimum Absolute Difference in BST
530. Minimum Absolute Difference in BST Given a binary search tree with non-negative values, find th ...
- WordCount去除标点方法之一
package com.bw.day10;import java.io.IOException;import java.util.StringTokenizer;import org.apache.h ...
- JavaScript闭包只学这篇就够了
闭包不是魔法 这篇文章使用一些简单的代码例子来解释JavaScript闭包的概念,即使新手也可以轻松参透闭包的含义. 其实只要理解了核心概念,闭包并不是那么的难于理解.但是,网上充斥了太多学术性的文章 ...
- webpack 引入 bootstrap
Bootstrap中是一种事实上的界面标准,标准到现在的网站大量的使用它.如果可以使用webpack引入的bootstrap,就可以一个npm install完成项目的依赖,而不必手工的添加到html ...