504 Gateway Time-out

发布时间 2023-08-03 19:51:50作者: zno2

 

 

 

现状:nginx 代理某api 接口,业务是统计一年数据,计算量较大,耗时2分钟,导致页面返回 504 

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout

Syntax: proxy_read_timeout time;
Default:
proxy_read_timeout 60s;
Context: httpserverlocation

Defines a timeout for reading a response from the proxied server. The timeout is set only between two successive read operations, not for the transmission of the whole response. If the proxied server does not transmit anything within this time, the connection is closed.

 

http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_read_timeout

Syntax: fastcgi_read_timeout time;
Default:
fastcgi_read_timeout 60s;
Context: httpserverlocation

Defines a timeout for reading a response from the FastCGI server. The timeout is set only between two successive read operations, not for the transmission of the whole response. If the FastCGI server does not transmit anything within this time, the connection is closed.

 

proxy 走代理,fastcgi 不走代理。试着把proxy_read_timeout 调整为180s ,可以了