Nginx报错日志有如下内容:

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

服务器开发环境: SLES12sp2 + Nginx + PHP-FPM + Maraidb集群

请求PHP页面,浏览器一直处在加载状态,页面阻塞,没有任何反应;

网上很多资料,大意是修改nginx配置文件,延长fastcgi等待时间,但不能解决根本问题。

经测试,问题出在php-fpm,php代码要使用file存取session,读写数据库,其中有一项操作缓慢,都能造成nginx假死;

解决方案:

打开php-fpm慢日志:

mkdir /var/log/php-fpm && chown nginx:nginx /var/log/php-fpm

vi   /etc/php7/fpm/php-fpm.d/www.conf

修改:

request_slowlog_timeout = 2s

request_terminate_timeout = 30s

slowlog = /var/log/php-fpm/$pool.log.slow

重启nginx和php-fpm

刷新页面,页面一直停留在阻塞状态,没有反应,这时,

tailf  /var/log/php-fpm/www.log.slow

可以清楚看到执行慢的语句和操作,这样就能找到具体原因!

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. 压测 502 日志报错 upstream timed out (110: Connection timed out)

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

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

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

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

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

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

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

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

  7. nginx 超时问题: upstream timed out (110: Connection timed out) while reading response header from upstream

    目录 错误内容 错误原因 错误解决办法 错误内容 我们可以在error.log 里面可以看到 错误内容:upstream timed out (110: Connection timed out) w ...

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

  9. 解决flask的502错误:upstream prematurely closed connection while reading response header from upstream

    我在使用 tiangolo/uwsgi-nginx-flask 部署flask应用的时候,经常运行一会儿就出现502错误,重新启动容器后,就恢复. 且经常会出现数据更新后,刷新结果不一致. docke ...

随机推荐

  1. decltype的参数是左值时,得到一个引用类型

    int* a = new int(10); decltype(*a) 得到的是引用类型:int&

  2. int(a) 和 (int &) a 及 数据存储地址的探究

    做题做到一个很有意思的题 void main() { float a = 1; cout << boolalpha << ((int)a == (int &)a); f ...

  3. day12-python的类

    类的一般形式: 创建类我们一般用class关键字来创建一个类,class后面跟类名字,可以自定义,最后以冒号结尾,如下所示: class ClassName: '''类的说明''' 类的内容 类的内容 ...

  4. dns资源记录类型

    资源记录的定义格式: 语法:name [TTL] IN RR_TYPE value SOA: name:当前区域的名字,例如"magedu.com.",或者"2.168. ...

  5. Cracking The Coding Interview 3.2

    //How would you design a stack which, in addition to push and pop, also has a function min which ret ...

  6. 打开和写入excel文件

    一.使用win32读取excel内容 # -*- coding: utf-8 -*- from win32com import client as wc def open_excel(): excel ...

  7. MyEclipse教程:使用UML创建模块库——第二部分(一)

    MyEclipse 在线订购年终抄底促销!火爆开抢>> [MyEclipse最新版下载] UML2建模文件存储在建模存储库中,建模可用于生成Java代码,或者可以从代码生成模型. 本教程介 ...

  8. 18-09-08 关于Linux 的安装遇到的一些小坑

    具体参考我的有道笔记 备注  那个网络问题已经解决 先自动选择打上勾 然后在进行选择 并且正确输入 IP地址之类的 ====用utrallo 制作centos7.0 报错 以下是新的工具有效===== ...

  9. BSTR 转 char*

    #include <comdef.h> #include <comutil.h> #pragma comment(lib,"comsuppw.lib") _ ...

  10. ESP8266 上报数据到贝壳物联

    下面贴上代码: #include <aJSON.h> #include <SPI.h> #include <Wire.h> #include <dht11.h ...