Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Web Servers»Nginx»How to Increase Request Timeout in NGINX

    How to Increase Request Timeout in NGINX

    RahulBy RahulJanuary 13, 20222 Mins ReadUpdated:January 13, 2022

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

    In this quick FAQ, you will learn to change the request timeout in NGINX web server.

    Increase Request Timeout in NGINX

    For example, you want to increase request timeout to 300 seconds. Then you need to add proxy_read_timeout, proxy_connect_timeout, proxy_send_timeout directives to http or server block. Here the http block allows the changes in all server in NGINX.

    To make changes for all servers, edit the NGINX main configuration file and add the following content under http block.

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

    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 300;
       proxy_connect_timeout 300;
       proxy_send_timeout 300; 
       ...
    }
    

    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, With the above changes, you have successfully increased the request timeout in NGINX server.

    Conclusion

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

    nginx
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Disable HTTP Methods in Apache
    Next Article How to Install Python 3.10 on CentOS/RHEL 8 & Fedora 35/34

    Related Posts

    How To Install Linux, Nginx, MySQL, & PHP (LEMP Stack) on Ubuntu 22.04

    Updated:April 7, 20227 Mins Read

    How to Install Nginx, MySQL & PHP (LEMP) on Ubuntu 20.04

    5 Mins Read

    How To Install Nginx with PHP-FPM on Ubuntu 20.04

    Updated:December 3, 20203 Mins Read

    How to Install Nginx on Ubuntu 20.04

    3 Mins Read

    How to Configure Nginx for WordPress Permalinks

    Updated:April 21, 20202 Mins Read

    How to Install Nginx with PHP-FPM on CentOS 8

    Updated:March 7, 20204 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    • (Resolved) Please install all available updates for your release before upgrading
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.