Nginx异常信息 upstream timed out (110: Connection timed out) while reading response header from upstream
upstream timed out (110: Connection timed out) while reading response header from upstream
Nginx代理配置如下:
###proxy settings start
proxy_http_version 1.1;
proxy_connect_timeout 3s;
proxy_read_timeout 3s;
proxy_send_timeout 3s;
proxy_buffer_size 128k;
proxy_buffers 256 16k;
proxy_busy_buffers_size 128k;
proxy_ignore_client_abort on;
###proxy settings end
语法:proxy_read_timeout time;
默认值:proxy_read_timeout 60s;
上下文:http,server,location
Defines a timeout for reading a response from the proxied server. The timeout is set only between two successive read operations, not for the transmission of the whole response. If the proxied server does not transmit anything within this time, the connection is closed.
需要注意的是,这个超时时间并不是针对单个请求的响应超时时间,而是针对两个成功响应之间的间隙,即如果被代理服务器在设置时间内没有发送任何数据,连接将被关闭
proxy_http_version设置为1.1,Nginx和被代理服务器之间默认使用长连接进行通信

在req2的响应返回之前,距resp1成功返回的时间已经超过了proxy_read_timeout的设置值(proxy_read_timeout设置的值比较小,并且系统QPS较低),Nginx直接断开了连接导致无法成功获取req2的响应
修改nginx配置,将proxy_read_timeout的值由3s修改为10s
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了