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 ...
随机推荐
- 20155209 2016-2017-2 《Java程序设计》第八周学习总结
20155209 2016-2017-2 <Java程序设计>第八周学习总结 教材学习内容总结 Java NIO(New IO)是一个可以替代标准Java IO API的IO API(从J ...
- MessageBox的常见用法
一 函数原型及参数 function MessageBox(hWnd: HWND; Text, Caption: PChar; Type: Word): Integer; hWnd:对话框父窗口句柄, ...
- 图片适应bitmap的大小 http上传文件
image.setAdjustViewBounds(true); http上传文件 http://www.eoeandroid.com/thread-90209-1-1.html http://www ...
- 通过hbase实现日志的转存(MR AnalyserLogDataRunner和AnalyserLogDataMapper)
操作代码(提前启动集群(start-all.sh).zookeeper(zkServer.sh start).启动历史任务服务器(mr-jobhistory-daemon.sh start histo ...
- hdu 5024 最长的L型
http://acm.hdu.edu.cn/showproblem.php?pid=5024 找到一个最长的L型,L可以是斜着的 简单的模拟 #include <cstdio> #incl ...
- 解决Sublime Text 3中文显示乱码和语法着色问题 等问题
一:解决sublime中文乱码的问题 简单安装: 1.打开Sublime Text 3,按Ctrl+-打开控制行,复制粘贴以下python代码,然后回车运行. 2. 复制并粘贴如下代码: import ...
- Python学习-40.Python中的迭代
在上一篇中,我们使用了生成器来创建了一个可遍历的对象.在其中,我们使用了yield关键字. Python我也正在学习中,因此对yield的本质我并不熟悉,但是,在C#中,yield关键字则是语法糖,其 ...
- 解决 Eclipse Indigo 3.7、ADT 中文字体偏小,完美 Consolas 微软雅黑混合字体!
Eclipse是著名的跨平台的自由集成开发环境(IDE).6月22日Eclipse 3.7 正式发布,代号是 Indigo . 在 Windows 7 下初始后化,发现界面变化不大,但中文字体却面目全 ...
- linux系统编程之管道(二):管道读写规则
一,管道读写规则 当没有数据可读时 O_NONBLOCK disable:read调用阻塞,即进程暂停执行,一直等到有数据来到为止. O_NONBLOCK enable:read调用返回-1,errn ...
- 利用HttpWebRequest模拟表单提交
using System; using System.Collections.Specialized; using System.IO; using System.Net; using System. ...