1. 程式人生 > >Nginx日常報錯處理總結

Nginx日常報錯處理總結

Nginx錯誤日誌中,有大量的下列資訊:

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

[[email protected] 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,

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

1. nginx proxy

需要適當的調整proxy_read_timeout值。

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

 

2. Nginx作為php-fpm等等其他的有上游服務

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

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;
}