Taken from following Source:
https://ubiq.co/tech-blog/increase-request-timeout-nginx/
Increase Request Timeout in NGINX
If you want to increase request timeout to 300 seconds, then add proxy_read_timeout, proxy_connect_timeout, proxy_send_timeout directives to http or server block
http{
...
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;
...
}
In the above case, the request timeout will be increased for all servers in your NGINX configuration file.
If you want to increase request timeout only for a specific server or subdomain, then add proxy_read_timeout, proxy_connect_timeout, proxy_send_timeout directives for its server block.
server{
...
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;
...
}
If you want to increase request timeout only for specific folder or URL, then add proxy_read_timeout, proxy_connect_timeout, proxy_send_timeout directives for that specific location block.
location /upload {
...
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;
...
}
For large values, you can also specify time units such as 1d for 1 day.