tengine 502 Bad Gateway in Server

pgpifvop  于 2022-12-31  发布在  其他
关注(0)|答案(1)|浏览(179)

502 Bad Gateway

The proxy server received an invalid response from an upstream server. Sorry for the inconvenience.
Please report this message and include the following information to us.
Thank you very much!

URL: http://code.taobao.org/mailman/listinfo/tengine-cn
Server: taocode-master
Date: 2017/03/27 15:18:16
Powered by Tengine

m1m5dgzv

m1m5dgzv1#

解析设置不当,查看 /var/log/nginx/error.log 的日志

以我遇到的情况为例

2018/03/10 19:53:56 [crit] 6979#0: *806 connect() to unix:/run/php/php7.1-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 157.119.xxx.xx, server: xxx.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.1-fpm.sock:", host: "view.2heng.xin", referrer: "https://xxx.com"

可见原因是 php-fpm 的 Permission denied,所以需要设置 nginx.conf 里的 user,将配置文件第一行

#user  nobody;

改为(www-data 是我的 php 设置)

user www-data;

相关问题