nginx fpm 常见错误对比分析

fastcgi_read_timeout 8; // nginx.conf
request_terminate_timeout=0 // php-fpm.conf

sleep(10);

浏览器 8 秒后返回 504 Gateway Time-out

nginx-error.log
upstream timed out (110: Connection timed out) while reading response header from upstream

 

fastcgi_read_timeout 8; // nginx.conf
request_terminate_timeout=5 // php-fpm.conf

sleep(10);

浏览器 5 秒后返回 502 Bad Gateway

nginx-error.log
recv() failed (104: Connection reset by peer) while reading response header from upstream
fpm-error.log
[pool www] child 5378, script ‘/usr/share/nginx/html/sleep.php’ (request: “GET /sleep.php”) execution timed out (5.793874 sec), terminating

 

fastcgi_read_timeout 8; // nginx.conf
request_terminate_timeout=5 // php-fpm.conf

set_time_limit(1);
while(true){}

浏览器返回 500 Internal Server Error
php-error.log
[08-Apr-2017 23:39:44 Asia/Shanghai] PHP Fatal error: Maximum execution time of 1 second exceeded in /usr/share/nginx/html/while_true.php on line 3

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注