Error content
We can see it in error. Log
Error: upstream timed out (110: Connection timed out) while reading response header from upstream
Cause of error
From the error log, we can know that the error is due to the timeout of nginx agent to get the return value of upstream server. What causes this problem
It takes a long time for the back-end to process the request
It may also be a network problem between the proxy server and the upstream server
We find out the problem by locating the wrong URL, and finally determine that the problem is due to the long time of back-end processing of the request. Then the solution can be that developers optimize the interface, or we can set the timeout time longer through nginx
Error resolution
nginx timeout setting
Official website link: 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: | http,server,location |
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.
proxy_ read_ Timeout parameter. This instruction refers to the time-out for two successful read operations from the upstream server. It means that after 60 seconds of successful read operation from the upstream server, if there is no successful read operation from the upstream server, the connection will be closed
The default value is 60s. We can set it to 240s or 300s. To deal with the problem of slow processing of requests by upstream servers
In the configuration file of nginx, add
proxy_read_timeout 240s;
Similar Posts:
- [Solved] Nginx proxy Timeout: upstream timed out (110: Connection timed out)
- [Solved] When PostgreSQL writes data to Excel, there is a failure your, nginx error handling
- [Solved] nginx upstream timed out (110 connection timed out)
- Fix Nginx 502 Error:upstream sent too big header while reading response header from upstream
- Solutions to nginx upstream timed out (Two Situations)
- [Solved] Nginx 502Bad Gateway: some static resources cannot be accessed
- Solve the 400 error of nginx forwarding websocket
- Nginx an upstream response is buffered to a temporary file,nginx502 Error
- Visit the back-end application through nginx and report an error err_ CONTENT_ LENGTH_ MISMATCH
- HTTP status code 499 [How to Solve]