Tecadmin published a quick tutorial about how to increase request timeout in NGINX.
How to Increase Request Timeout in NGINX
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.