Error: 504 Gateway Time-out (502 Bad Gateway) NGINX Apache
This error means that the php script (nginx backend, apache) waited too long for a response from the web server and the script ended before the response was received.
Some scripts require an increase in waiting and execution time, this applies to the operation of the E-Trade Tunnel module, if a large amount of data is uploaded to the site.
Increasing nginx timeout while proxying
To change the timeout in the nginx config, you need to change the following parameters (it is better to insert them into the location context):
proxy_send_timeout 600; # время ожидания при передаче запроса
proxy_read_timeout 600; # время ожидания при чтении ответа
The number 600 means that nginx will wait 10 minutes.
The time is specified in seconds, the default is 60, i. e. 1 minute.
But you need to be prepared that not every hoster will go for it, because. increase in limits = increase in resource consumption.
Increasing php-fpm timeout
To solve the problem in the case of php-fpm, you need to add two lines to the fastgci configuration block:
Increasing Apache Timeout
To change the Apache timeout in the httpd. conf config file, you need to change the following parameters:
# Timeout: The number of seconds before receives and sends time out.