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() & ...
随机推荐
- 【KMP】BZOJ3942-[Usaco2015 Feb] Censoring
[题目大意] 有一个S串和一个T串,长度均小于1,000,000,设当前串为U串,然后从前往后枚举S串一个字符一个字符往U串里添加,若U串后缀为T,则去掉这个后缀继续流程.输出最后的S串. [思路]三 ...
- 【tarjan+缩点】POJ1236[IOI1996]-Network of Schools
[题意] 见:http://blog.csdn.net/ascii991/article/details/7466278 [思路] 缩点+tarjan,思路也可以到上面的博客去看.(吐槽:这道题其实我 ...
- thinkphp去重统计数据sql
DISTINCT 方法用于返回唯一不同的值 官方文档给出的示例: $Model->distinct(true)->field('userName')->select(); 解析的SQ ...
- H5 manifest离线缓存
请跳转我的有道云笔记查看: http://note.youdao.com/noteshare?id=caaf067c6e38820ba8f87b212c2327a9&sub=23E0F8F7A ...
- jQuery中,选择器既匹配开头又匹配结尾
jQuery中,选择器既匹配开头又匹配结尾的方法: [attr^=val]attr$=val [attr^=val][attr$=val]
- 理解PHP的变量,值与引用的关系
--- title: 理解PHP的变量,值与引用的关系 createdDate: 2015-03-11 category: php --- PHP的变量与C++中的变量是两种截然不容的概念.如果没有理 ...
- 【转载】Instagram架构分析笔记
原文地址:http://chengxu.org/p/401.html Instagram 架构分析笔记 全部 技术博客 Instagram团队上个月才迎来第 7 名员工,是的,7个人的团队.作为 iP ...
- Git系列一之安装管理
1.Git安装部署 Git是分布式的版本控制系统,我们只要有了一个原始Git版本仓库,就可以让其他主机克隆走这个原始版本仓库,从而使得一个Git版本仓库可以被同时分布到不同的主机之上,并且每台主机的版 ...
- 在Spring3中使用注解(@Scheduled)创建计划任务
Spring3中加强了注解的使用,其中计划任务也得到了增强,现在创建一个计划任务只需要两步就完成了: 创建一个Java类,添加一个无参无返回值的方法,在方法上用@Scheduled注解修饰一下: 在S ...
- javat Itext实践 pdf
1.简介 iText是著名的开放项目,是用于生成PDF文档的一个java类库.通过iText不仅可以生成PDF或rtf的文档,而且可以将XML.Html文件转化为PDF文件. 下载地址:https:/ ...