504 Gateway timeout for large file uploads

For CGI PHP mode you have to add to Apache config (/etc/httpd/conf/httpd.conf):

Timeout 150

150 sec is enough for me. I have SSD disk and my files up to 10Gb.
By default there is no such variable in httpd.conf on CentOS 7 and default timeout is 60 sec.
As a frontend i use nginx and you have to add this line to server section of your ssl vhost config to make nginx wait more:

proxy_read_timeout 150;

PHP max_execution_time is not critical, and i have it set to 30.
After adding these 2 lines, restart nginx and httpd. Big file uploads will not get stuck locked with 504, 423 errors any more.

1 Like