upstream timed out (110: Connection timed out) error in Nginx

          I faced this issue in Nginx(when using as reverse proxy agent) where I send a request to the web server and the web server takes quite sometime to process the request(may be 3 to 5 minutes) and send the response as file. I my case, the connection to the server was getting closed exactly after 60 seconds which is due to read timeout. The default Nginx configuration takes 60 seconds as default timeout value. This error will be logged in Nginx error log and will not be reported in the browser end in case of any web application. The generic error will be as follows.

An error occurred.

Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.

Steps to Change the Default Timeout Duration

  1. Go to Nginx(folder)->conf.d
  2. Open default.conf
  3. Add proxy_read_timeout duration_in_seconds; to location block. E.g.  proxy_read_timeout 1200;
  4. Restart the Nginx server.

Sample Configuration (default.conf)

server {
     listen 80;

location / {
     proxy_read_timeout 1200;
     //Other Configuration

            The above configuration will set the read timeout to 20 minutes. 

Leave a Reply