Gateway Timeout error 504
504 Gateway Timeout
When using php-cgi add this in httpd.conf
TimeOut 3600
Or add it in Apache config by creating a config file in conf.d dir
touch /usr/local/apache/conf.d/timeout.conf
echo “TimeOut 3600” > /usr/local/apache/conf.d/timeout.conf
service httpd restart
When using PHP-FPM add this in domain vhosts under “proxy_fcgi_module” config:
Domain Apache vhosts location is in /usr/local/apache/conf.d/vhosts
ProxyTimeout 3600
eg :
SetHandler “proxy:unix:/opt/alt/php-fpm72/usr/var/sockets/username.sock|fcgi://localhost”
ProxyTimeout 3600
you can also create a Apache vhost template and add the ProxyTimeout there and use it for the domain you need for increased timeout. You can copy default.stpl and default.tpl to timeout.stpl and timeout.tpl with same content only with below replace config :
php-fpm default templates can be found here :
/usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts/httpd/php-fpm
eg :
replace :
SetHandler “proxy:%backend_fcgi%|fcgi://localhost”
with :
SetHandler “proxy:%backend_fcgi%|fcgi://localhost”
ProxyTimeout 3600
after you created the template go to webserver domain config and select the template there under php-fpm thats it or choose default trmeplate in webserver main conf and don’t forget to restart Apache web server if you manually added the timeout in vhost.
If you need Unlimited timeout then you need to disable this apache module :
LoadModule reqtimeout_module modules/mod_reqtimeout.so
go to /usr/local/apache/conf and edit httpd.conf find this line LoadModule reqtimeout_module modules/mod_reqtimeout.so and comment it out i.e. add “#” before this line. Save it and restart Apache server
eg :
#LoadModule reqtimeout_module modules/mod_reqtimeout.so