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. Python print打印

    1.Python运算符: +:加 -:减 *:乘 /:除以 %:去除法后的余数 //:取整除 2.字符串center方法: a='111'print(a.center(4,'2')) #让字符串占位 ...

  2. 【Loadrunner_WebService接口】对项目中的GetProduct接口生成性能脚本

    一.环境 https://xxx.xxx.svc?wsdl 用户名:username 密码:password 对其中的GetProduct接口进行测试 备注:GetProducts.xml文件内容和S ...

  3. JS&Jquery中的循环/遍历

    JavaScript中的遍历 for 遍历 var anArray = ['one','two']; for(var n = 0; n < anArray.length; n++) { //具体 ...

  4. Spring Boot + Spring Cloud 实现权限管理系统 (集成 Shiro 框架)

    Apache Shiro 优势特点 它是一个功能强大.灵活的,优秀开源的安全框架. 它可以处理身份验证.授权.企业会话管理和加密. 它易于使用和理解,相比Spring Security入门门槛低. 主 ...

  5. sql语句最后一行显示统计。

    SELECT id, username, id_Num FROM users UNION ALL SELECT '合计', count(*), null FROM users ORDER BY id_ ...

  6. 【转载】JVM系列一:JVM内存组成及分配

    java内存组成介绍:堆(Heap)和非堆(Non-heap)内存 按照官方的说法:“Java 虚拟机具有一个堆,堆是运行时数据区域,所有类实例和数组的内存均从此处分配.堆是在 Java 虚拟机启动时 ...

  7. 从R-CNN到FAST-RCNN再到Faster R-CNN

    (Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks)   R-CNN: (1)输入测试图像: ...

  8. Android : apk签名的多种方法以及key的配置

    方法一:使用Android SDK中的签名工具给apk签名: (1)Android源码的 build/target/product/security/ 目录下有 media.pk8.media.x50 ...

  9. 查看linux 内核版本信息

    uname -r2.6.32-696.el6.x86_64uname -ix86_64

  10. 玩转X-CTR100 l STM32F4 l FPU单精度浮点性能测试

    我造轮子,你造车,创客一起造起来!塔克创新资讯[塔克社区 www.xtark.cn ][塔克博客 www.cnblogs.com/xtark/ ]      本文介绍X-CTR100控制器如何开启ST ...