502 Bad Gateway(Nginx) 查看nginx日志有如下内容
2016/09/01 09:49:41 [error] 79464#79464: *3 user "nagios" was not found in "/usr/local/nagios/etc/htpasswd.users", client: 192.168.1.209, server: localhost, request: "GET / HTTP/1.1", host: "192.168.1.5"
2016/09/01 09:49:45 [error] 79464#79464: *3 user "nagios" was not found in "/usr/local/nagios/etc/htpasswd.users", client: 192.168.1.209, server: localhost, request: "GET / HTTP/1.1", host: "192.168.1.5"
2016/09/01 09:49:51 [crit] 79464#79464: *3 connect() to unix:/tmp/phpfpm.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.1.209, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/phpfpm.sock:", host: "192.168.1.5"
2016/09/01 09:49:51 [error] 79464#79464: *3 open() "/usr/local/nagios/share/favicon.ico" failed (2: No such file or directory), client: 192.168.1.209, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "192.168.1.5"
2016/09/01 09:49:51 [error] 79464#79464: *3 open() "/usr/local/nagios/share/favicon.ico" failed (2: No such file or directory), client: 192.168.1.209, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "192.168.1.5"
前面两个是因为密码不对
第二个说是connect() to unix:/tmp/phpfpm.sock failed 重点是:(13: Permission denied)
后面的错误是因为受到[crit]的影响而来的
这里呢,上次碰到过一次,不过也弄了好久,
这一次有点印象,就很容易找到原因,并且修改回来
开始修改文件了--------------------------
[root@dep5 ~]# vim /usr/local/php/etc/php-fpm.conf
查找phpfpm.sock这一向,发现这个sock在/tmp下面,
[root@dep5 ~]# ll /tmp/phpfpm.sock
srw-rw---- 1 root root 0 9月 1 08:30 /tmp/phpfpm.sock
发现phpfpm.scok的属主属组都是root用户,并且权限为660
而且源码安装PHP和Nginx指定的用户是daemon,daemon,根本没权限查看和修改这个sock文件
解决一方案:
vim /usr/local/php/etc/php-fpm.conf
查找下面那两个
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0660
listen.owner=****
listen.group=****
将那listen.owner和listen.group注释取消掉,并且改成nginx用户
或者
将 ;listen.mode = 0660 注释取消的,直接改成777得了(^_^)
解决方案二:
chmod 777 /tmp/phpfpm.sock
#PS:我没试过这个方案,但觉得可行,但是这里还有个问题,当把php-fpm重启的时候,权限又被自己改回来了,。。。。。
502 Bad Gateway(Nginx) 查看nginx日志有如下内容的更多相关文章
- nginx 502 Bad Gateway 错误问题收集
nginx 502 Bad Gateway 错误问题收集 (2010-11-18 13:51:37) 转载▼ 标签: 杂谈 分类: 工作 nginx 502 Bad Gateway 错误问题收集 因为 ...
- Nginx记录-Nginx基础(转载)
1.Nginx常用功能 1.Http代理,反向代理:作为web服务器最常用的功能之一,尤其是反向代理. Nginx在做反向代理时,提供性能稳定,并且能够提供配置灵活的转发功能.Nginx可以根据不同的 ...
- 记一次nginx部署yii2项目时502 bad gateway错误的排查
周六闲来无事,就试着安装和部署下yii2,安装过程没什么问题,但部署到nginx上时遇到了502 bad gatewary问题,折腾了半天才搞定.这个问题是我以前在部署yii2时没有遇到过的,因此记在 ...
- Nginx 502 Bad Gateway 错误的原因及解决方法
http://my.oschina.net/zhouyuan/blog/118708 刚才在调试程序的时候,居然服务器502错误,昨天晚上也发生了,好像我没有做非常规的操作. 然后网上寻找了下答案, ...
- NGINX+UWSGI 莫名发生Nginx 502 Bad Gateway错误的排查过程
自己有个阿里云UBUNTU运行的Django站,使用NGINX+UWSGI驱动,今天登陆系统后台更新内容出现了几个大字:Nginx 502 Bad Gateway,一看情况不好,这是要糟糕啊. 啊西八 ...
- Nginx 502/504 Gateway time-out错误完美解决方案【转发】
在安装完Nginx+PHP-fpm+Mysql后,跑PHP的应用会经常出现504 Gateway Time-out 或者502 Bad Gateway的情况. Nginx 504 Gateway ...
- Nginx 显示502 Bad Gateway错误
今天系统发布到测试环境,有一个用户登录后显示502 Bad Gateway错误,其他的用户都登录成功.但是在开发机链接测试数据库,使用该账号登录成功. 初步猜测是Nginx的问题,查看nginx的错 ...
- nginx 502 bad gateway 问题处理集锦
一般看来, 这种情况可能是由于nginx默认的fastcgi进程响应的缓冲区太小造成的, 这将导致fastcgi进程被挂起, 如果你的fastcgi服务对这个挂起处理的不好, 那么最后就极有可能导致5 ...
- nginx 502 Bad Gateway 错误解决办法
nginx出现502有很多原因,但大部分原因可以归结为资源数量不够用,也就是说后端PHP-fpm处理有问题,nginx将正确的客户端请求发给了后端的php-fpm进程,但是因为php-fpm进程的问题 ...
- [Chrome_Error] (failed) net::ERR_INCOMPLETE_CHUNKED_ENCODING 与 nginx 502 bad gateway
Chrome 浏览器出现这个错误,还出现 nginx 502 bad gateway . 查看 nginx 的 error.log : 2015/12/18 14:34:44 [error] 1448 ...
随机推荐
- struts2中的<s:select>默认选项
//... public class SelectAction extends ActionSupport{ private List<String> searchEngine; priv ...
- HDU2181:哈密顿绕行世界问题(DFS)
哈密顿绕行世界问题 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Sub ...
- 使用Github搭建个人博客网站
1 新建一个repo,创建一个没有父节点的分支gh-pages(github规定,只有该分支中的页面,才会生成网页文件): mkdir jekyll_demo cd jekyll_demo git i ...
- sphinx multi valued filter
publn_date is multi-valued <?php ini_set('memory_limit', '-1'); ini_set('max_execution_time', '10 ...
- 后台前台json传递数据的方式两种方式 $.get, $.getJSON
第一种getJSON方式: 前台调用: <td><input type="text" class="t" id="edutitle& ...
- 고서--做完A之后做B, B受A影响
1. 합격 소식을 듣고서 매우 기뻤어요.. 2. 친구하고 심하게 다투고서 마음이 안 좋았어요. 3. 급한 일을 먼저 끝내고서 이야기합시다.' 4. 창문을 열고서 상쾌한 공기를 마서 ...
- Entity Framework 学习初级篇4--Entity SQL
Entity SQL 是 ADO.NET 实体框架 提供的 SQL 类语言,用于支持 实体数据模型 (EDM).Entity SQL 可用于对象查询和使用 EntityClient 提供程序执行的查询 ...
- zabbix agent自动安装脚本
#!/bin/bash #desc: used for autoinstall zabbix client #说明:本脚本旨在批量安装zabbix_agent,在一个服务器上放好软件和配置文件,执行本 ...
- 用memcached的时候找key找不到,写了个命令来找找
for i in $(seq 30); do echo "stats cachedump $i 0" | nc 192.168.88.150 11211 | grep groupS ...
- 【矩阵压缩】 poj 1050
题意:给一个矩阵,里面有正负数,求子矩阵和的最大值 #include <iostream> #include <cstdio> #include <stdlib.h> ...