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. CP-ABE ToolKit 安装笔记(转载)

    博主论文狗,好久没有来贴博客,最近做实验需要用到属性加密,了解了下CP-ABE,前来记录一下: 网上相关的博文较多,博主看了大部分的,认为下面这两个看完了基本就可以成功安装. 可参见博文: http: ...

  2. K-Means ++ 和 kmeans 区别

    Kmeans算法的缺陷 聚类中心的个数K 需要事先给定,但在实际中这个 K 值的选定是非常难以估计的,很多时候,事先并不知道给定的数据集应该分成多少个类别才最合适Kmeans需要人为地确定初始聚类中心 ...

  3. Python3组播通信编程实现教程(发送者+接收者)

    一.说明 1.1 标准组播解释 通信分为单播.多播(即组播).广播三种方式 单播指发送者发送之后,IP数据包被路由器发往目的IP指定的唯一一台设备的通信形式,比如你现在与web服务器通信就是单播形式 ...

  4. SecureCRT修改显示行数

    Scrollback buffer应该是保留的行数,初始值500,修改成自己想要的数值保存即可. 参考:http://blog.csdn.net/w410589502/article/details/ ...

  5. rnnlib依赖ubuntu环境配置

    rnnlib help http://sourceforge.net/apps/mediawiki/rnnl/index.php?title=Main_Page boost: http://blog. ...

  6. laravel 查询指定字段的值

    $this->model->where('id',$id)->value('user');

  7. linux内核initcall

    include/linux/init.h #define pure_initcall(fn) __define_initcall(fn, 0) #define core_initcall(fn) __ ...

  8. UVA LA 3983 - Robotruck DP,优先队列 难度: 2

    题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_pr ...

  9. mac下VirtualBox跟linux虚拟机共享文件夹

    1.在VirtualBox中设置好共享目录,设置自动挂载/固定分配 2.安装增强工具,为了避免安装出错需要安装依赖文件 #更新内核. yum update kernel#需要安装相应的kernel-d ...

  10. js call回调的this指向问题

    function fn1(){ console.log(1); } function fn2(){ console.log(2); } fn1.call(fn2); //输出 1 fn1.call.c ...