nginx 502错误 failed (13: Permission denied)

安装好nginx和php-fpm后出现502的错误 查找原因是说php-fpm没有启动 ,但在我实际中这个进程是启动的 找了半天没找到原因,查看nginx日志后 发现以下错误

[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: "[...]"

遇到这种的解决方法

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

同时把下面这些打开

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

重启服务

service php5-fpm restart

重启后一切OK

相似问题

ubuntu12.04安装php5-fpm 出错connect() to unix:/var/run/php5-fpm.sock

时间: 2024-10-10 21:22:20

nginx 502错误 failed (13: Permission denied)的相关文章

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:

nginx:connect() to 127.0.0.1:5601 failed (13: Permission denied) while connecting to upstream错误

重启了下服务器,nginx反向代理访问kibana就报错: 查了下日志发现是这个错: connect() to 127.0.0.1:5601 failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1 和权限有关的,就是selinux呗. [[email protected] ~]# getenforce Enforcing 看了下果真如此!坑爹啊!我忘记关了.关掉后就没事了. setenforce

解决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 (label: homebrew.mxcl.nginx) ==> Successfully started nginx (label: homebrew.mxcl.nginx) 但是实际上没启动成功,查看下错误日志 tail -n 10 /usr/local/var/log/nginx/error.l

Starting nginx: nginx: [emerg] bind() to 0.0.0.0:8088 failed (13: Permission denied) nginx 启动失败

Starting nginx: nginx: [emerg] bind() to 0.0.0.0:8088 failed (13: Permission denied) nginx 启动失败,日志里面报错信息如下: Starting nginx: nginx: [emerg] bind() to 0.0.0.0:8088 failed (13: Permission denied) 权限拒绝,经检查发现是开启selinux 导致的. 直接关闭 getenforce   这个命令可以查看当前是否开

解决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: Permission denied) while connecting to upstream, 经过一番检查以及google,应该是SeLinux的导致的.可以选择一些两种方式进行: 1.关闭SeLinux,可以查看以下文章: CentOS下查看SeLinux状态及关闭SeLinux 2.执行下面的命令

nginx bind() to 0.0.0.0:**** failed (13: Permission denied)

nginx 启动失败,日志里面报错信息如下: Starting nginx: nginx: [emerg] bind() to 0.0.0.0:**** failed (13: Permission denied) 权限拒绝,经检查发现是开启selinux 导致的. 直接关闭 getenforce   这个命令可以查看当前是否开启了selinux 如果输出 disabled 或 permissive 那就是关闭了 如果输出 enforcing 那就是开启了 selinux 1.临时关闭selin

socket() failed (13: Permission denied) while connecting to upstream

/*************************************************************************** * socket() failed (13: Permission denied) while connecting to upstream * 说明: * 这个错误隐藏的挺深的,观察了许久,才从ps aux中的执行用户中找出来. * * 2016-9-26 深圳 南山平山村 曾剑锋 ******************************

nginx open() "" failed (13: Permission denied), client

起先是,访问nginx报错,随即分析log发现如下错误 已经提示目录权限不对 尝试赋予权限 #chmod -R 755 /var/www/hao123 再次访问,故障解决

【Nginx】nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)

这是端口号的问题,在Linux中1024以下的端口号都需要root权限才能使用,所以普通用户启动程序绑定会报出权限问题. 使用如下命令启动nginx. sudo nginx