错误内容

我们可以在error.log 里面可以看到

错误内容:upstream timed out (110: Connection timed out) while reading response header from upstream

错误原因

从错误日志我们可以知道,该错误是由于nginx 代理去获取上游服务器的 返回值超时了。那么这个问题是什么导致的:

  1. 该请求获取的数据比较多,后端处理该请求花费的时间较长。
  2. 也可能是代理服务器与上游服务器的网络问题

我们通过定位出错的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的更多相关文章

  1. nginx 报错 upstream timed out (110: Connection timed out)解决方案

    nginx 作PHP的web接口服务器. 在线上发现时不时经常崩溃.504,导致接口访问无响应回复. 查看日志: [error] 11618#0: *324911 upstream timed out ...

  2. 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) ...

  3. nginx 报错 upstream timed out (110: Connection timed out)解决方案【转】

    转自 nginx 报错 upstream timed out (110: Connection timed out)解决方案 - 为程序员服务http://outofmemory.cn/code-sn ...

  4. Nginx Upstream timed out (110: Connection timed out)

    Nginx Upstream timed out (110: Connection timed out) – 运维生存时间 http://www.ttlsa.com/nginx/nginx-upstr ...

  5. 压测 502 日志报错 upstream timed out (110: Connection timed out)

    环境介绍 服务器:centos6.5服务:nginx proxy 问题描述: 压测 开发同事 的开发环境项目没事,但是 线上机器 命中%50 ,大量502 php的某些页面打不开,页面提示gatewa ...

  6. 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 ...

  7. upstream timed out (110: Connection timed out) while reading response header from upstream, client:

    遇到的问题 之前没配置下面这段,访问时候偶尔会出现 504 gateway timeout,由于偶尔出现,所以不太好排查 proxy_connect_timeout 300s;proxy_read_t ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. 探求Floyd算法的动态规划本质

    Floyd–Warshall(简称Floyd算法)是一种著名的解决任意两点间的最短路径(All Paris Shortest Paths,APSP)的算法.从表面上粗看,Floyd算法是一个非常简单的 ...

  2. 好用的SHELL小编程

    1>判断输入为数字,字符或其他      脚本代码:      检测结果:   2>求平均数:   测试效果:     3>自减输出: 脚本代码: 测试效果:    4>在文件 ...

  3. 【Win10】页面的导航效果

    CommonNavigationTransitionInfo ContinuumNavigationTransitionInfo DrillInNavigationTransitionInfo Ent ...

  4. 程序员MAC必备

    排名不分先后 • iTerm 2 终端工具(建议配合oh-my-zsh使用) • Shadowsocks     ***工具 (可用于FQ) • Foxmail 邮箱工具 (适用于企业邮箱登陆) • ...

  5. git archive命令详解

    git archive可以将加了tag的某个版本打包提取出来,例如: git archive -v --format= > v0..zip --format表示打包的格式,如zip,-v表示对应 ...

  6. 简易Python语句获取本机ip地址

    import os, socket def public_ip(): try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.conne ...

  7. SqlServer Session共享注意点

    公司下派任务,之前的网站是一台服务器,由于用户过多,负载过大,现在老大要求多加一台服务器.加就加贝,应该跟我这DEV没有 关系吧,应该不会碰到Source的吧.但是,之前网站有一些数据是放在Sessi ...

  8. 服务端JSON内容中有富文本时

    问题背景 由于数据中存在复杂的富文本,包含各种引号和特殊字符,导致后端和前端通过JSON格式进行数据交互引发前端JSON解析出错. 解决方案 后端将富文本内容 ConvertToBase64Strin ...

  9. 微信游戏《全民炫舞》开发公司h3d2 engine和QQ炫舞2 布料系统技术介绍

    H3D公司开发的<全民炫舞>上线了. 蝉联IOS榜首很多天. 整理了一下过去公司游戏引擎开发的历史.有兴趣可以去看看 公司游戏引擎开发历史介绍: http://www.h3d.com.cn ...

  10. s11 day Linux 和nginx 部署

      https://www.cnblogs.com/pyyu/p/9481344.html ,开机初始化的配置 iptables -F 清空防火墙 /etc/init.d/iptables stop ...