當我的php腳本需要運行超過60秒時,我總是收到504網關錯誤。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網關錯誤。
my phpinfo();輸出
max_execution_time 600
max_input_time 180
我看到的增加該fastcgi_connect_timeout幾個職位,但不知道在哪裏可以找到這種媒體的寺廟。
誰能幫助感謝
UPDATE仍然無法修復這個
與支持,我被告知我需要編輯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
希望這可以幫助別人
我認爲這是一個新的設置,因爲我從來沒有遇到與他們的舊服務器有問題,但有一個新的服務器,我打開並跑到這。你的文章確實幫了很大忙。我的應用程序運行在Apache模塊模式下,這仍然解決了這個問題。真的有幫助! – David
嘿@ user1503606 - 您最後一次更新的作品!發佈它作爲你的答案,並找到解決方案的功勞。 – squarecandy
我建議你重構你的應用程序,以消除需要運行一個腳本超過200毫秒。您可能需要將一些沉重的邏輯移動到背景。使用以下任何技術來幫助您:AJAX,消息隊列,memcache,標誌文件。 –