php fpm安装curl后,nginx出现connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied)的错误
这里选择直接apt-get安装,因为比起自己编译简单多了,不需要自己配置什么
#sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
安装后重启nginx
#nginx -s reload
岂知出现错误,php全部不能访问,查看错误日志如下:
2014/07/24 23:59:46 [crit] 40455#0: *229072 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 171.9
处理方式是:编辑/etc/php5/fpm/pool.d/www.conf文件,将以下的注释去掉:
listen.owner = www-data
listen.group = www-data
listen.mode =
然后重启php5-fpm
sudo service php5-fpm restart
即可。参考文章:
After doing an upgrade on my Debian virtual server, which upgraded PHP and Nginx, I got a "502 Bad Gateway" error when browsing websites on that server. This post shows how to fix this problem, and the configuration option to prevent it occurring again on reboot.
tl;dr
Edit /etc/php5/fpm/pool.d/www.conf and uncomment the following:
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
Then run:
sudo service php5-fpm restart
Longer answer
As well as the error in the browser, I was getting this error in the Nginx error log:
[crit] 2686#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.50.1, server: [...], request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "[...]"
The problem is caused by the permissions and ownership of the /var/run/php5-fpm.sock file, which after I'd done the upgrade change to something like root:root and 0660, so it couldn't be accessed by the www-data user which Nginx was running as.
The immediate solution is to change the permissions and/or ownership of the file like so:
chmod 0666 /var/run/php5-fpm.sock
OR
chmod 0660 /var/run/php5-fpm.sock
chown www-data:www-data /var/run/php5-fpm.sock
The only catch is this won't persist after the server is restarted. To prevent the issue from occurring again, edit the /etc/php5/fpm/pool.d/www.conf file:
sudo nano /etc/php5/fpm/pool.d/www.conf
Locate the following lines and uncomment them:
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
If you already changed the ownership/permissions of the socket file as shown above, then you don't need to do anything else now. If you didn't, then run this:
sudo service php5-fpm restart
This re-creates the socket file with the ownership and permissions as configured in the file.
php fpm安装curl后,nginx出现connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied)的错误的更多相关文章
- nginx 502错 failed (13: Permission denied)
安装nginx和php-fpm之后出现502错误 找了个理由说php-fpm不启动 ,但在我的实践中,该过程开始 找了半天没找到病因.视图nginx记录后 我发现下面的错误 [crit] 2686#0 ...
- 解决Nginx的connect() to 127.0.0.1:8080 failed (13: Permission denied) while connect
在进行Nginx+Tomcat 负载均衡的时候遇到了这个权限问题,在error.log日志中.我们能够看到例如以下: connect() to 127.0.0.1:8080 failed (13: P ...
- 解决nginx访问问题connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream,
问题:搭建好项目之后,用nginx进行代理,进行日常配置之后,发现前端正常访问,但是后端访问出现错误,报502错误,查找nginx日志,发现connect() to 127.0.0.1:8080 fa ...
- 转connect() to unix:/var/run/php-fpm.sock failed (11: Resource temporarily unavailable)
网站常出现502 bad gateway,程序没有问题. 根据nginx日志:connect() to unix:/var/run/php-fpm.sock failed (11: Resource ...
- connect() to unix:/var/run/php-fpm.sock failed (11: Resource temporarily unavailable)
nginx + php做服务,在高并发的时候会出现一些错误 connect() to unix:/var/run/php-fpm.sock failed (11: Resource temporar ...
- Ubuntu nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
在Ubuntu 12中启动刚安装好的Nginx,报错: nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied) 原因如下: ...
- nginx权限问题failed(13:Permission denied)
nginx权限问题failed(13:Permission denied) 环境配置 nginx Permission denied 问题: 使用nginx代理uwsgi,出现500错误,查看ngi ...
- 解决Mac nginx问题 [emerg] 54933#0: bind() to 0.0.0.0:80 failed (13: Permission denied)
brew services restart nginx Stopping nginx... (might take a while) ==> Successfully stopped nginx ...
- nginx: [emerg] open() "/var/run/nginx.pid" failed (13: Permission denied)
现象 1.centos6.9 用rpm包安装nginx 2.修改Nginx的多个配置文件和配置项 3.service nginx restart 报错: nginx: [emerg] open() & ...
随机推荐
- code M资格赛 补题
A: 音乐研究 时间限制:1秒 空间限制:32768K 美团外卖的品牌代言人袋鼠先生最近正在进行音乐研究.他有两段音频,每段音频是一个表示音高的序列.现在袋鼠先生想要在第二段音频中找出与第一段音频最相 ...
- 【树形dp】Godfather
[POJ3107]Godfather Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7212 Accepted: 253 ...
- [TCO2013]DirectionBoard
题意:给一个网格,每个格子有一个方向表示在这个格子上要往哪个方向走,你可以改变某些格子的方向,问最少多少次操作使得从任意格子出发都能回到这个格子 woc这都不会我还是回家种田去吧... 题目的要求是改 ...
- [NOI2017]整数
[NOI2017]整数 题目大意: \(n(n\le10^6)\)次操作维护一个长度为\(30n\)的二进制整数\(x\),支持以下两种操作: 将这个整数加上\(a\cdot2^b(|a|\le10^ ...
- String类的compareTo()和compareToIgnoreCase()
compareTo()的返回值是int,它是先比较对应字符的大小(ASCII码顺序) 1.如果字符串相等返回值0 2.如果第一个字符和参数的第一个字符不等,结束比较,返回他们之间的差值(ascii码值 ...
- Spring MVC常用注解@PathVariable、@RequestHeader、@CookieValue、@RequestParam、@RequestBody、@SessionAttributes、@ModelAttribute
简介: handler method参数绑定常用的注解,我们根据他们处理的Request的不同内容部分分为四类:(主要讲解常用类型) A.处理requet uri部分(这里指uri template中 ...
- 利用Python编写网络爬虫下载文章
#coding: utf-8 #title..href... str0='blabla<a title="<论电影的七个元素>——关于我对电影的一些看法以及<后会无期 ...
- centos7 安装selenium和firefox
之前有一篇文章介绍过在ubuntu下安装selenium和firefox 现在介绍下centos7 注意以下都是下载的linux64位的软件,32位的请自己找下链接, 现在使用的python的版本是3 ...
- unity 显示mipmaplevel
https://docs.unity3d.com/ScriptReference/Texture2D.SetPixels.html 显示mipmaplevel 需要贴图可读写不压缩 using Uni ...
- Hibernate:SQL查询 addScalar()或addEntity()
Hibernate除了支持HQL查询外,还支持原生SQL查询. 对原生SQL查询执行的控制是通过SQLQuery接口进行的,通过执行Session.createSQLQuery()获取这个接口.该 ...