php – 504 Gateway超时媒体寺

当我的PHP脚本需要运行超过60秒时,我经常遇到504个网关错误.

我在专用服务器上的媒体寺庙.我已经联系了媒体寺,他们一直很有帮助,但他们的建议似乎都不适合我,我被告知要编辑这个文件.

/etc/httpd/conf.d/fcgid.conf

我必须在下面

LoadModule fcgid_module modules/mod_fcgid.so

<IfModule mod_fcgid.c>

<IfModule !mod_fastcgi.c>
    AddHandler fcgid-script fcg fcgi fpl
</IfModule>

  FcgidIPCDir /var/run/mod_fcgid/sock
  FcgidProcesstableFile /var/run/mod_fcgid/fcgid_shm
  FcgidIdleTimeout 300
  FcgidMaxRequestLen 1073741824
  FcgidProcessLifeTime 10000
  FcgidMaxProcesses 64
  FcgidMaxProcessesPerClass 15
  FcgidMinProcessesPerClass 0
  FcgidConnectTimeout 600
  FcgidioTimeout 600
  FcgidInitialEnv RAILS_ENV production
  FcgidIdleScanInterval 600

</IfModule>

所以我尽可能多地尝试最大化,测试这个我只是运行下面的功能.

function test504(){
        @set_time_limit(0);
        sleep(60);
        echo "true";
    }

睡眠将在60秒以下的任何值上工作,返回true但在60上我得到504网关错误.

我的PHPinfo();输出

max_execution_time 600
max_input_time 180

我已经看到一些关于增加这个fastcgi_connect_timeout的帖子,但不知道在媒体寺庙的哪个地方找到它.

谁能帮忙谢谢

更新仍然无法修复此问题

在与支持人员聊天后,我被告知需要编辑Nginx.conf?并被定向到这篇文章http://blog.secaserver.com/2011/10/nginx-gateway-time-out/

不能罚款托管上的任何值.
client_header_timeout
client_body_timeout
send_timeout
fastcgi_read_timeout

我的Nginx.conf文件看起来像这样

#error_log  /var/log/Nginx/error.log  info;

#pid        /var/run/Nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  /var/log/Nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  120;
    #tcp_nodelay        on;

    #gzip  on;
    #gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    server_tokens off;

    include /etc/Nginx/conf.d/*.conf;
}

这让我疯狂任何建议???

更新我设法在最后得到这个排序后,很多头痛添加了一篇关于我如何修复此问题的博客文章.
http://devsforrest.com/116/boost-settings-on-media-temple-for-maximum-settings

希望这有助于某人

我也有同样的问题,我通过编辑Nginx.conf文件解决了它.在大多数情况下,可以通过在Nginx.conf中添加/增加send_timeout指令来解决此问题.

找到你的Nginx.conf文件(通常位于/usr/local/Nginx/Nginx.conf或有时/ etc / Nginx / sites-available / default),使用nano或任何其他文本编辑器打开它,并在之间添加以下行http {}所以它看起来像:

http {
include       mime.types;
default_type  application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  /var/log/Nginx/access.log  main;

sendfile        on;
#tcp_nopush     on;
#keepalive_timeout  0;
keepalive_timeout  120;
#tcp_nodelay        on;

#gzip  on;
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";

server_tokens off;

send_timeout 10m;

include /etc/Nginx/conf.d/*.conf;
}

在我的情况下,我不得不增加一些其他指令,如:

client_header_timeout 10m;
client_body_timeout 10m;
send_timeout 10m;
fastcgi_read_timeout 10m;

太.

编辑完文件后,只需重新加载Nginx

kill -HUP `ps -ef | grep Nginx | grep master | awk {'print $2'}`

要么

sudo service Nginx restart

那应该解决它.

(我在这里找到了指令:http://blog.secaserver.com/2011/10/nginx-gateway-time-out/)

PS:我看到OP的评论带有他们博客链接,但我认为在这里添加相关信息可能有所帮助.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...