
服务器换了之后,Nginx 反代后端 API 一直 502 Bad Gateway,本地 curl 后端是通的,求指点。
相关配置片段:
location /api/ {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
已排查:后端端口监听正常、防火墙放行、SSL 证书也生效了(静态页能开)。是不是 upstream 或者 proxy_pass 尾巴的斜杠问题?有没有遇到过的大哥帮忙看看,感激不尽!
把 fastcgi_read_timeout 调大再重启试试,我们之前也是这么解决的。
502 多半是 upstream 超时或 PHP-FPM 挂了,先看 error.log 里 upstream 那行。