How to Increase Request Timeout in NGINX

Nginx timeout

In some cases, the long-running requests failed with the error message “504: Gateway Timeout” in the NGINX web server. To solve this issue, you need to increase the request timeout in NGINX web server configuration. The default, NGINX request timeout is 60 seconds. Which can be increased or decreased by updating the configuration files.

In this speedy FAQ, you will figure out how to change the request timeout in the NGINX web server.

Increase Request Timeout in NGINX

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


In case, you just want to increase request timeout for a specific server or subdomain, then add the directives for its server block only. Edit the specific server block configuration file and add the following settings:


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


After making the changes, you must restart the NGINX service to apply changes. The systems running with Systemd can use the following command.


sudo systemctl restart nginx 


All done that's it, With the above changes, you have successfully increased the request timeout in the NGINX web server.


Conclusion

This tutorial helps you to increase request timeout in the NGINX web server.

Post a Comment

© LinuxFault. All rights reserved. Developed by Jago Desain