nginx 反代偶发 504:后端日志只花 2 秒超时怎么设

陆零云 31 0
后台导出订单偶尔 504,不是每次都这样,一天五六次。nginx error.log 里是 upstream timed out (110: Connection timed out) while reading response header from upstream,request_time 60.003,upstream_response_time 那一栏是短横线。 短横线说明 nginx 连响应头都没等到。但 PHP 慢日志里同一个请求只花了 1...

Nginx proxy_pass 加了 upstream 后接口路径 404 location 里的 URL 被吃掉了怎么解决

陆零云 41 0
现象:proxy_pass 加 upstream 后接口全是 404 给后端 API 集群加了 Nginx upstream 做负载均衡,proxy_pass 写成 http://api_backend 以为大功告成,结果所有请求都是 404。curl 测上游服务器本身接口正常,Nginx access_log 显示请求确实转发到了 upstream 但 URL 路径被改写了。排查半小时才发现是 location 和 proxy_pass 末尾斜杠的经典坑...