0
我在长于5分钟的脚本上收到502错误的网关响应。502使用Nginx 1.6.2和PHP 5.6.4在Ubuntu 14.04上发现坏的网关
服务器在Ubuntu 14.04运行具有Nginx的1.6.2和5.6.4 PHP
心中已经创建了一个测试功能,这将失败:
public function test(){
sleep(600);
}
心中已经试图改变的fastcgi PARAMS ,没有变化。
配置:
server {
listen 80;
server_name www.xxxx.xx;
root /home/forge/xxxx.xx/public;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
# ssl_certificate_key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
index index.html index.htm index.php;
charset utf-8;
location/{
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/xxxx.xx-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_param PHP_VALUE "newrelic.appname=xxxx.xx";
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
}
nginx.conf HTTP块(心中已经改变的部分):
http {
fastcgi_buffers 32 32k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 3600;
fastcgi_send_timeout 3600;
fastcgi_read_timeout 3600;
# EDIT: Added and tried these:
client_header_timeout 3600;
client_body_timeout 3600;
proxy_read_timeout 3600;
proxy_connect_timeout 3600;
}
的php.ini:
max_execution_time = 3600
记录错误:
2015/10/20 10:01:12 [error] 5132#0: *297705 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 195.215.168.170, server: xxxx.xx, request: "GET /cron/test HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "xxxx.xx"
花费不尽的时间寻找解决方案,但我试过的每个解决方案都没有任何效果。所以任何帮助都敞开双臂欢迎!
php.ini中'max_execution_time'的值是多少? – n00dl3
您是否为PHP设置了set_time_limit(int $ seconds)? – messy
max_execution_time = 3600 尚未设置set_time_limit – TheNish