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/ 不能罚款托管上的任何值. 我的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; } 这让我疯狂任何建议??? 更新我设法在最后得到这个排序后,很多头痛添加了一篇关于我如何修复此问题的博客文章. 希望这有助于某人
我也有同样的问题,我通过编辑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的评论带有他们博客的链接,但我认为在这里添加相关信息可能有所帮助. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |