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 ...
随机推荐
- Hbase和Hive的异同
共同点:1.hbase与hive都是架构在hadoop之上的.都是用hadoop作为底层存储 区别:2.Hive是建立在Hadoop之上为了减少MapReduce jobs编写工作的批处理系统,HBa ...
- 在EBS里新建一个OU的步骤
http://blog.csdn.net/kevingao/archive/2010/09/11/5877092.aspx 在EBS里新建一个OU的步骤1. 建立OU组织,关联SOB,LE2. 系统管 ...
- Delphi for iOS开发指南(5):在iOS应用程序中使用Calendar组件来选择日期
http://blog.csdn.net/delphiteacher/article/details/8923519 在FireMonkey iOS应用程序中的Calendar FireMonkey使 ...
- TFS 如何強制撤銷被簽出的文件
我们在使用TFS (Team Foundation Server) 源代码管理的时候,源代码管理会在每个PC上创建一个工作区,然后这个工作区域映像到服务器上的源码文件夹,我们在正常签入,签出的时候,我 ...
- Asp.net MVC Linq to SQL Model verification
Models public class Student { public int Id { get; set; } [Required(ErrorMessage = "姓名不能为空!&quo ...
- pageadmin CMS网站建设教程:如何修改用户密码?
pageadmin CMS网站建设教程: 当我们想修改密码,该如何修改呢? 1. 首先,登录会员中心,会员中心的地址是在网址后面加上/member/login: 2. 例:我的网站地址是localho ...
- C博客作业03—函数
1.本章学习总结 1.1思维导图 1.2本章学习体会及代码量学习体会 1.2.1 学习体会 知道了程序的模块化设计可使程序结构清晰,简化复杂问题,解决代码重复问题 学会使用自定义函数简化主函数,使代码 ...
- python format()函数的用法
Python format() 函数的用法 复制自博主 chunlaipiupiupiu 的博客,如有侵权,请联系删除 python中format函数用于字符串的格式化 通过关键字 1 print(' ...
- elasticsearch geo_point 地理位置过滤 按经度排序
elasticsearch 支持强大的经纬度坐标过滤. 1.首先要建立坐标类型的字段'type' ='geo_point' es存储的值是这样的: "poi": [ ...
- javascript中创建对象的几种不同方法
javascript中创建对象的几种不同方法 方法一:最直白的方式:字面量模式创建 <script> var person={ name:"小明", age:20, s ...