Fix cpanel http 504 gateway timeout error

You got http 504 gateway time out error in browser when visiting your wordpress site, and you see fcgi timeout error like follows in /usr/local/apache/logs/error_log

[proxy_fcgi:error] (70007)The timeout specified has expired: [client xxx.xxx.xxx.xxx:8959] AH01075: Error dispatching request to : (polling)

To fix this, you need to increase the TimeOut and ProxyTimeout in Apache Configuration file. It’s best to change this for an individual user than in global virtual host file.

Eg: the cpanel user id is “USERNAME”

You need to create file /etc/apache2/conf.d/userdata/ssl/2_4/USERNAME/php-fpm.conf, then add following two lines to overwrite the default settings.

TimeOut 600
ProxyTimeout 600