php – 504 Gateway超时媒体寺

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了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的评论带有他们博客链接,但我认为在这里添加相关信息可能有所帮助.

脚本宝典总结

以上是脚本宝典为你收集整理的php – 504 Gateway超时媒体寺全部内容,希望文章能够帮你解决php – 504 Gateway超时媒体寺所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。