[error] upstream timed out (110: Connection timed out) while reading upstream

I configured nginx as a loadbalance and reverse proxy. there were 2 real servers in back-end.

If client access this website through nginx ip address. nginx server will forward the request to any one

upstream servers by different loadbalance arithmetic, and the real server will deal with it and response

to client through this nginx server.

but the response speed of uptream server a little slow.

It’s normal if I access the real server directly. but I encuntered the error of invalid session when access

website through nginx.

error log below:

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

Nginx proxy parameter below:

###proxy settings start

proxy_http_version 1.1;

proxy_connect_timeout 3s;

proxy_read_timeout 3s;

proxy_send_timeout 3s;

proxy_buffer_size 128k;

proxy_buffers 256 16k;

proxy_busy_buffers_size 128k;

proxy_ignore_client_abort on;

###proxy settings end

grammar: proxy_read_timeout time;

default value: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.

set value of proxy_http_version as 1.1, this indicate that system will create keep-alive connection

between Nginx and proxied server.

so I modified the value of proxy_read_timeout from default to 120s.

then I restart nginx server, this error disappeared.

Leave a Reply