Nginx平常報錯處理總結

Nginx錯誤日誌中,有大量的下列信息:php

Upstream timed out (110: Connection timed out) while reading response header from upstreamnginx

[root@www vhosts]# tailf /usr/local/nginx/logs/qderp_error.log
2018/10/31 02:05:39 [error] 12831#0: *149343 upstream timed out (110: Connection timed out) while reading response header from upstream, 
2018/10/31 02:05:39 [error] 12831#0: *149341 upstream timed out (110: Connection timed out) while reading response header from upstream, 
2018/10/31 02:05:39 [error] 12831#0: *149342 upstream timed out (110: Connection timed out) while reading response header from upstream, 
2018/10/31 02:05:39 [error] 12831#0: *149340 upstream timed out (110: Connection timed out) while reading response header from upstream, 
2018/10/31 02:05:39 [error] 12831#0: *149338 upstream timed out (110: Connection timed out) while reading response header from upstream,

這種狀況主要在下面兩種狀況下發生:spa

1. nginx proxy

須要適當的調整proxy_read_timeout值。日誌

location / {
        ...
        proxy_read_timeout 150;
        ...
    }

 

2. Nginx做爲php-fpm等等其餘的有上游服務

在這種狀況下,適當的調整fastcgi_read_timeout選項值code

location ~* .php$ {
    include         fastcgi_params;
    fastcgi_index   index.php;
    fastcgi_read_timeout 150;
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
}
相關文章
相關標籤/搜索