nginx 超时问题: upstream timed out (110: Connection timed out) while reading response header from upstream
错误内容
我们可以在error.log 里面可以看到
错误内容:upstream timed out (110: Connection timed out) while reading response header from upstream
错误原因
从错误日志我们可以知道,该错误是由于nginx 代理去获取上游服务器的 返回值超时了。那么这个问题是什么导致的:
- 该请求获取的数据比较多,后端处理该请求花费的时间较长。
- 也可能是代理服务器与上游服务器的网络问题
我们通过定位出错的url,来排查问题,最终确定问题是由于 该请求需要后端处理的时间比较长。
那么解决办法可以是开发人员对该接口进行优化,也可以是我们通过nginx将超时时间设置长些。
错误解决办法
nginx 超时时间设置
官网链接:http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout
| Syntax: | proxy_read_timeout time; |
|---|---|
| Default: | proxy_read_timeout 60s; |
| Context: | 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_read_timeout 参数, 该指令是指从上游服务器两次成功的读操作耗时的超时时间,也就意味着从上游服务器成功读操作后,过了60S,没有再从上游服务器成功读操作的话,就会关闭该连接。
默认值是 60s ,我们可以设置为240s,或者300s。来应对上游服务器处理请求慢的问题。
在nginx 的配置文件 在 http,server,location 三个位置任意一个位置
加上
proxy_read_timeout 240s;
nginx 超时问题: upstream timed out (110: Connection timed out) while reading response header from upstream的更多相关文章
- nginx 报错 upstream timed out (110: Connection timed out)解决方案
nginx 作PHP的web接口服务器. 在线上发现时不时经常崩溃.504,导致接口访问无响应回复. 查看日志: [error] 11618#0: *324911 upstream timed out ...
- Nginx报错:upstream timed out (110: Connection timed out)和client intended to send too large body【转】
nginx日志报错 2018/01/26 16:36:49 [error] 23327#0: *54953 upstream timed out (110: Connection timed out) ...
- nginx 报错 upstream timed out (110: Connection timed out)解决方案【转】
转自 nginx 报错 upstream timed out (110: Connection timed out)解决方案 - 为程序员服务http://outofmemory.cn/code-sn ...
- Nginx Upstream timed out (110: Connection timed out)
Nginx Upstream timed out (110: Connection timed out) – 运维生存时间 http://www.ttlsa.com/nginx/nginx-upstr ...
- 压测 502 日志报错 upstream timed out (110: Connection timed out)
环境介绍 服务器:centos6.5服务:nginx proxy 问题描述: 压测 开发同事 的开发环境项目没事,但是 线上机器 命中%50 ,大量502 php的某些页面打不开,页面提示gatewa ...
- xdebug 一直报错 upstream timed out (110: Connection timed out) while reading response header from upstream
本地主机(Windows环境192.168.66.1)访问虚拟机(192.168.66.139)里面的搭建的php环境(系统centos6.5版本,php版本是5.5.30 ,xdebug 2.4.0 ...
- upstream timed out (110: Connection timed out) while reading response header from upstream, client:
遇到的问题 之前没配置下面这段,访问时候偶尔会出现 504 gateway timeout,由于偶尔出现,所以不太好排查 proxy_connect_timeout 300s;proxy_read_t ...
- upstream timed out (110: Connection timed out) while reading response header from upstream
Nginx报错日志有如下内容: upstream timed out (110: Connection timed out) while reading response header from up ...
- nginx error: upstream prematurely closed connection while reading response header from upstream
本篇文章由:http://xinpure.com/nginx-error-upstream-prematurely-closed-connection-while-reading-response-h ...
随机推荐
- POJ2456 Aggressive cows 2017-05-11 17:54 38人阅读 评论(0) 收藏
Aggressive cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13993 Accepted: 6775 ...
- 从问题域看hadoop的各种技术
近些年来Hadoop生态系统发展迅猛,它本身包含的软件越来越多,同时带动了周边系统的繁荣发展.尤其是在分布式计算这一领域,系统繁多纷杂,时不时冒出一个系统,号称自己比MapReduce或者Hive高效 ...
- Windows Server 2008 R2远程桌面服务配置和授权激活
远程桌面服务安装好之后使用的是120天临时授权,所以会跳出以下提示,我们介绍远程桌面授权的激活. 现在我们使用命令 mstsc /admin 强制登录服务器 需要在“远程桌面服务”--安装“远程桌面授 ...
- 【WinRT】获取 Uri 中的参数(QueryString)键值对
在控制台或者其它类型的项目中,可以添加 System.Web,使用以下代码来获取一个 Uri 中的参数 Uri uri = new Uri("http://www.cnblogs.com/h ...
- Python学习-16.Python中的错误处理
虽然叫错误,但跟 C# 中的异常是一回事.只不过 Python 中叫错误(Error)而 C# 中叫异常(Exception). 先手工产生一个异常: file = open('','r') 上面一句 ...
- FreeBSD下面安装PostgreSQL。
1.确认pkg版本大于1.1.4,可以用pkg -v查看,如果小于此版本,请升级.2.在/usr/local/etc/pkg.conf文件中,删除掉repository相关的语句,像PACKAGESI ...
- C# wpf InkCanvas 保存图片jpg
前端xaml页面代码 <Window x:Class="WpfApplication6.MainWindow" xmlns="http://schemas.micr ...
- sqlServer数据库常用连接字符串
sqlServer 数据库常用连接字符串 用户名和密码验证的方式去连接到数据库服务器 <add name="conStr" connectionString=" ...
- 解决DbContext对象创建问题
解决DbContext对象创建问题 方法一: 使用CallContext public class BaseController : Controller { public MyContext db ...
- Spring Boot 学习系列(10)—SpringBoot+JSP的使
此文已由作者易国强授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 解决问题 随着spring boot 框架的逐步使用,我们期望对于一些已有的系统进行改造,做成通用的脚手架, ...