访问时候偶尔会出现504 gateway timeout,查看日志发现报以下错误:
...upstream timed out (110: Connection timed out) while reading response header from upstream, client: ...(后面的省略)
之前没配置下面这段,由于偶尔出现,所以不太好排查
proxy_connect_timeout 300s;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_ignore_client_abort on;
从日志看来是连接超时了,需要调整代理超时参数proxy_read_timeout,把这个参数调大,加入上面那段配置即可