排查502错误
1、查看/usr/local/nginx/conf/nginx.conf
从而知道其错误日志在哪。
重点查看其错误日志。
2、如果是/tmp/dd.sock
2017/05/01 18:48:33 [error] 2015#0: *1 access forbidden by rule, client: 192.168.81.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "192.168.81.130"
2017/05/01 18:48:41 [crit] 2015#0: *2 connect() to unix:/tmp/dd.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.81.1, server: www.dd.com, request: "GET /forum.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/dd.sock:", host: "www.dd.com"
则是/tmp/dd.sock文件权限问题,用户nobody读取不到此文件
3、解决办法:
vim /usr/local/php/etc/php-fpm.conf
加入用户,及组可对文件进行读取
如下:listen.owner = nobody
listen.group = nobody
并重启php-fpm服务
/etc/init.d/php-fpm restart