How to Increase Request Timeout in Nginx

Sometimes the long-running requests are unsuccessful with the error message “504: entry Timeout” in NGINX web server. to resolve this issue, you wish to extend the request timeout in NGINX server configuration. The default, NGINX request timeout is sixty seconds. which might be accrued or shrunken by changing the configuration files.

In this fast listingyou may learn to alter the request timeout in NGINX net server.

Increase Request Timeout in NGINX


For example, you wish to extend the request timeout to three hundred seconds. Then you wish to feature proxy_read_timeout, proxy_connect_timeout, proxy_send_timeout directives to hypertext transfer protocol or server block. Here the hypertext transfer protocol block permits the changes all told server in NGINX.

To make changes for all servers, edit the NGINX main configuration file and add the subsequent content beneath HTTP block.

http{
   ...
   proxy_read_timeout 300;
   proxy_connect_timeout 300;
   proxy_send_timeout 300;
   ...
}

In case, you simply wish to extend request timeout for a selected server or subdomain, then add the directives for its server block solely. Edit the particular server block configuration file and add the subsequent settings:


server{
   ...
   proxy_read_timeout 300;
   proxy_connect_timeout 300;
   proxy_send_timeout 300; 
   ...
}

After creating the changes, you need to restart the NGINX service to use changes. The systems running with Systemd will use the subsequent command.

sudo systemctl restart nginx 

Conclusion

If You like this post you can Also Read

Leave a Reply