ubuntu14.04 nginx报upstream timed out 问题原因,解决办法
来源:互联网 发布:java 毫秒转日期 编辑:程序博客网 时间:2024/06/07 04:53
访问php时一直出现http 504Gateway Time-out错误
错误日志里看到几百个 upstream timed out 的错误
2016/11/0110:32:45 [error] 3897#0: *1831129 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 42.92.152.137, server: xxx.xxx.cn, request: “GET / HTTP/1.1″, upstream: “fastcgi://unix:/var/run/php5-fpm.sock:″, host: “xxx.xxx.cn”, referrer: “http://xxx.xxx.cn/”
从日志的表示来看应该不是nginx的问题,而是 fast-cgi 执行超时没有及时返回数据到ngnix的问题. 可web和数据库负载都不高,不应该是程序超时的问题.
一般看来, 这种情况可能是由于nginx默认的fastcgi进程响应的缓冲区太小造成的, 这将导致fastcgi进程被挂起, 如果你的fastcgi服务对这个挂起处理的不好, 那么最后就极有可能导致504 Gateway Time-out
现在的网站, 尤其某些论坛有大量的回复和很多内容的, 一个页面甚至有几百K
默认的fastcgi进程响应的缓冲区是8K, 我们可以设置大点
在nginx.conf里, 加入:
fastcgi_buffers 8 128k
这表示设置fastcgi缓冲区为8×128k
当然如果您在进行某一项即时的操作, 可能需要nginx的超时参数调大点, 例如设置成60秒:
send_timeout 60;
NGINX反代理超时报错,解决方法:
server {
vi /etc/php5/fpm/php-fpm.conf 增加以下配置
后提示变成502了,
一看php的错误日志如下:
2016/11/01 10:36:46 [error] 5471#0: *238740 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 42.92.152.137, server:*.*.cn, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "*.*.cn"
肯定是之前修改了php-fpm.conf没有重启php-fpm的缘故
重启 /etc/init.d/php5-fpm restart
问题解决
- ubuntu14.04 nginx报upstream timed out 问题原因,解决办法
- Nginx报错:upstream timed out (110: Connection timed out)
- Nginx报错:upstream timed out (110: Connection timed out)
- NginX upstream timed out
- nginx proxy超时报错 upstream timed out (110: Connec...
- nginx 报错 upstream timed out (110: Connection timed out)解决方案
- nginx日志报错upstream timed out (110: Connection timed out)
- nginx超时的问题(*52081 upstream timed out)
- Nginx Upstream timed out (110: Connection timed out)
- nginx upstream timed out 10060错误解决
- nginx upstream timed out 10060错误解决
- win10 tomcat nginx upstream timed out 10060
- 工作总结28 Nginx性能调优一nginx proxy超时报错 upstream timed out (110: Connec.
- nginx upstream timed out (110: Connection timed out) while reading response header from upstream
- upstream timed out (110: Conn ection timed out)
- nginx php-fpm 110: Connection timed out) while connecting to upstream 错误
- upstream timed out (110: Connection timed out) while reading response header from upstream 问题解决
- Connection timed out: connect 解决办法
- Tomcat服务器虚拟目录的映射方式
- Java的wait(), notify()和notifyAll()使用小结
- 软考助手V1.8上线啦[耶]
- Pairs Forming LCM(唯一分解定理)
- IAR 编译协议栈Z-Stack有错误
- ubuntu14.04 nginx报upstream timed out 问题原因,解决办法
- java web入门到精通java调用mysql存储过程实例
- sql性能优化
- Docker学习总结之Run命令介绍
- 链表的建立、插入与删除
- Android Socket简单封装
- xcode 8.0 快捷注释无法使用
- windows平台上2014a以上的Matlab安装libsvm
- springMVC给基类baseMapper新增通用方法