dota2年兽 504gatewaytime-out

504 Gateway Time-out 怎样解决_百度知道
504 Gateway Time-out 怎样解决
提问者采纳
提交回答 回答 共1条 504 gateway time-out是网关超时以上回答你满意么:dong
您不登录也可以回答问题 输入内容已经达到长度限制还能输入 9989 字插入图片删除图片插入地图删除地图插入视频视频地图504 gateway time-out参考资料:0 | 离问题结束还有 7 天 3 小时 | 提问者504 gateway time-out什么意思 悬赏分
我是问怎么解决
提问者评价
相关专业回答
这是由于服务器端的配置出现了状况,平时也很少见到。
具体解决办法就是修改配置文件:
1、把max_children由之前的10改为现在的30,这样就可以保证 有充足的php-cgi进程可以被使用;
把request_terminate_timeout由之前的0s改为60s,这样php-cgi进程 处理脚本的超时时间就是60秒,可以防止进程都被挂起,提高利用效率。
2、接着再更改nginx的几个配...
其他类似问题
为您推荐:
gateway的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁What Does a 504 Gateway Time Out Mean? | eHow
Whenever you access a server through the Internet, a HTML status code is returned from the server to your browser. A number of these are error codes, which appear when there is a problem loading a page. The codes are displayed in the browser, and help webmasters and visitors understand what is going wrong so they can try to solve the problem. The &# Gateway Time Out” is one such error code.
When you attempt to access a resource, the server that your action is routed through places a time limit on that request. If a response is not received after a certain amount of time, a 504 error code is returned to the browser. The  at the beginning of the error code indicates that the problem is with the server being contacted, rather than your client server. The usual cause of a 504 error is attempting to contact a server that is either down, perhaps for maintenance, or otherwise not operating properly.
A client receives the request to access a certain URL. It accesses a Domain Name Server (DNS) to obtain the IP address of that site. An IP socket connection is made with the IP address obtained from the DNS, and a HTML data stream is sent through the socket. The client receives an HTTP data stream back from the server, and if the resource cannot be accessed after a certain amount of time, the data stream returned will contain the 504 error code. The browser then displays the code onscreen.
The 504 is technically called the &# Gateway Timeout” error. Like the &# Not Found” error, though, the message notification for the 504 can be customized. You will be commonly presented with one of the following messages on an otherwise blank page: &#: Gateway Timeout,” “HTTP 504,” or “HTTP Error 504 – Gateway Timeout.” However, you may be presented with a custom error screen, or simply be redirected to another page, such as the site's home page.
Because the 504 is a server-side error, you cannot fix the problem unless you own and maintain the server in question yourself. However, you do have a few options available to you. You could email the webmaster if you know her email address and notify her of the problem. You could try refreshing a few times, to see if it was a temporary problem, or you can return to the site at a later time, when the error will hopefully have been resolved.
Promoted By Zergnet
Is DIY in your DNA? Become part of our maker community.
Get Weekly DIY Guides & Inspiration
Life Made Easier.jie737421 的BLOG
用户名:jie737421
文章数:84
评论数:69
访问量:95618
注册日期:
阅读量:5863
阅读量:12276
阅读量:305536
阅读量:1023249
51CTO推荐博文
今天站群VPS上面的所有站出现的 504 网关错误,现在小色还是菜菜的,斗胆解决下。在网上面搜解决方案,尝试设置ngxin的fast-cgi_buffers 和重启ngxin来解决,但是错误依旧。怀疑是因为php卡住了或者内存过多。最终重启php-fpm,解决问题。
重启php Commend:service php-fpm restart
==此次收获==
在CentOS下配置lnmp组合基本上用的都是同样的配置文件,一直都没出现过问题,可最近在一个vps上安装同样的环境之后,网站在线10多人就出 现了打开速度非常缓慢的情况,有好几次都是直接达到了nginx中设置的脚本最大超时时间300秒,结果导致nginx往客户端浏览器发送了一个504 Gateway Time-out的错误代码,分析了之后改动了几处配置文件,终于避免了该情况的出现。
& 从错误代码基本可以确定跟nginx本身无关,主要是提交给php-fpm的请求未能正确反馈而导致,一般情况下,提交动态请求的时候,nginx会直接把 请求转交给php-fpm,而php-fpm再分配php-cgi进程来处理相关的请求,之后再依次返回,最后由nginx把结果反馈给客户端浏览器,但 我这个vps目前跑的是个纯php应用内容,实际上用户所有的请求都是php请求,有的耗费时间比较久,php-cgi进程就一直都被用满,而php- fpm本身的配置文件只打开了10组php-cgi进程,这样的话在线用户稍微多的话就会导致请求无法被正常处理而出错。
& 大概分析出了原 因,下面做就比较容易了,首先是更改php-fpm的几处配置:
& 把max_children由之前的10改为现在的30,这样就可以保证 有充足的php-cgi进程可以被使用;
& 把request_terminate_timeout由之前的0s改为60s,这样php-cgi进程 处理脚本的超时时间就是60秒,可以防止进程都被挂起,提高利用效率。
& 接着再更改nginx的几个配置项,减少FastCGI的请求次 数,尽量维持buffers不变:
& fastcgi_buffers由 4 64k 改为 2 256k;
& fastcgi_buffer_size 由 64k 改为 128K;
& fastcgi_busy_buffers_size 由 128K 改为 256K;
& fastcgi_temp_file_write_size 由 128K 改为 256K。
& 好了,重新加载php-fpm和nginx的配置,再次测试,至今两周时间内没有再出现504 Gateway Time-out的情况,算是达到效果了。 &
& 另外,php-fpm的默认静态处理方式会使得php-cgi的进程长期占用内存而无法释放,这也是导致nginx出错的原因之一,因此可以将php-fpm的处理方式改成apache模式。
& &value name=&style&&apache-like&/value&
& 从更改完毕到现在的测试表明上述方式的效果还是很明显的,并没有发现一次Nginx502 bad gateway或504 Gateway Time-out错误。当然,如果你的VPS或者服务器的性能足够好可以根据具体情况不必做无谓的改动。
=====================&&& 华丽的分界线 &&&=====================
504 Gateway Time-out问题常见于使用nginx作为web server的服务器的网站
我遇到这个问题是在升级discuz论坛的时候遇到的
一般看来, 这种情况可能是由于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的资料不是很多, 很多事情都需要长期的经验累计才有结果, 期待您的发现哈!
=====================&&& 以下引用网上文章 &&&====================
&Nginx 502 Bad Gateway的含义是请求的PHP-CGI已经执行,但是由于某种原因(一般是读取资源的问题)没有执行完毕而导致PHP-CGI进程终止。
  Nginx 504 Gateway Time-out的含义是所请求的网关没有请求到,简单来说就是没有请求到可以执行的PHP-CGI。
  解决这两个问题其实是需要综合思考的,一般来说Nginx 502 Bad Gateway和php-fpm.conf的设置有关,而Nginx 504 Gateway Time-out则是与nginx.conf的设置有关。
  而正确的设置需要考虑服务器自身的性能和访客的数量等多重因素。
  以我目前的服务器为例子CPU是奔四1.5G的,内存1GB,CENTOS的系统,访客大概是50人左右同时在线。
  但是在线的人大都需要请求PHP-CGI进行大量的信息处理,因此我将nginx.conf设置为:
fastcgi_connect_timeout&300s;&&  fastcgi_send_timeout&300s;&&  fastcgi_read_timeout&300s;&&  fastcgi_buffer_size&128k;&&  fastcgi_buffers&8&128k;#8&128&&  fastcgi_busy_buffers_size&256k;&&  fastcgi_temp_file_write_size&256k;&&  fastcgi_intercept_errors&on;&这里最主要的设置是前三条,即
  fastcgi_connect_timeout 300s;
  fastcgi_send_timeout 300s;
  fastcgi_read_timeout 300s;这里规定了PHP-CGI的连接、发送和读取的时间,300秒足够用了,因此我的服务器很少出现504 Gateway Time-out这个错误。最关键的是php-fpm.conf的设置,这个会直接导致502 Bad Gateway和504 Gateway Time-out。&  下面我们来仔细分析一下php-fpm.conf几个重要的参数:&  php-fpm.conf有两个至关重要的参数,一个是&max_children&,另一个是&request_terminate_timeout&&  我的两个设置的值一个是&40&P,一个是&900&P,但是这个值不是通用的,而是需要自己计算的。&  计算的方式如下:&  如果你的服务器性能足够好,且宽带资源足够充足,PHP脚本没有系循环或BUG的话你可以直接将&request_terminate_timeout&设置成0s。0s的含义是让PHP-CGI一直执行下去而没有时间限制。而如果你做不到这一点,也就是说你的PHP-CGI可能出现某个BUG,或者你的宽带不够充足或者其他的原因导致你的PHP-CGI能够假死那么就建议你给&request_terminate_timeout&赋一个值,这个值可以根据你服务器的性能进行设定。一般来说性能越好你可以设置越高,20分钟-30分钟都可以。由于我的服务器PHP脚本需要长时间运行,有的可能会超过10分钟因此我设置了900秒,这样不会导致PHP-CGI死掉而出现502 Bad gateway这个错误。&  而&max_children&这个值又是怎么计算出来的呢?这个值原则上是越大越好,php-cgi的进程多了就会处理的很快,排队的请求就会很少。设置&max_children&也需要根据服务器的性能进行设定,一般来说一台服务器正常情况下每一个php-cgi所耗费的内存在20M左右,因此我的&max_children&我设置成40个,20M*40=800M也就是说在峰值的时候所有PHP-CGI所耗内存在800M以内,低于我的有效内存1Gb。而如果我的&max_children&设置的较小,比如5-10个,那么php-cgi就会&很累&,处理速度也很慢,等待的时间也较长。如果长时间没有得到处理的请求就会出现504 Gateway Time-out这个错误,而正在处理的很累的那几个php-cgi如果遇到了问题就会出现502 Bad gateway这个错误。&
了这篇文章
类别:┆阅读(0)┆评论(0)}

我要回帖

更多关于 dota2官网 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信