Nginx 502 Bad Gateway
Nginx About 737 words现象
请求页面得到502 Bad Gateway
。
日志
查看error.log
日志,发现有upstream sent too big header while reading response header from upstream
日志。
2022/10/10 02:18:24 [error] 8333#8333: *28207118 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: example.com, request: "GET /test", upstream: "http://example.com", host: "example.com", referrer: "http://test.com/"
原因
请求的Header
过大,超出了Nginx
代理的缓存区大小。
解决
扩大参数值:proxy_buffer_size
、proxy_buffers
、proxy_busy_buffers_size
。
location / {
proxy_pass http://upstream;
...
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
Nginx 文档
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size
Views: 846 · Posted: 2023-03-13
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...