Multiple '504 errors' are shown on SSL pages or it takes a lot of time to load the website page. This can be fixed by restarting the 'apache' service, but the problem reoccurs.
Also the issue accrues when any large file (1+ GB) is being uploaded to any php software.
In domain logs
/var/www/vhosts/example.com/logs/ the following error can be found:
2013/11/15 03:32:13 [error] 12699#0: *5042589 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 203.0.113.2, server: example.com, request: "GET /wp-login.php HTTP/1.0", upstream: "https://203.0.113.2:7081/wp-login.php", host: "example.com", referrer: "https://example.com/register/"
Timeout error is often caused by issues on the backend connection that is serving the content. To fix this, first, you have to figure out what configuration you are using.
For Nginx as Proxy (php-fpm disabled)
To apply settings globally, increase the timeout values by creating the file
/etc/nginx/conf.d/timeout.confand restarting 'nginx' service:
# cat /etc/nginx/conf.d/timeout.conf
To increase timeout settings for a particular domain, add the lines mentioned above to 'Additional Nginx directives' at:
Plesk > Subscriptions > example.com > Websites & Domains > example.com > Apache & nginx Settings
For Nginx + FastCGI (php-fpm enabled)
Increase the value of
max_execution_timedirective (by choosing the value from the drop-down menu or by setting it manually) at:
Plesk > Subscriptions > example.com > Websites & Domains > example.com > PHP Settings
fastcgi_read_timeout 300;directive inside the 'nginx' virtual host configuration at:
Plesk > Subscriptions > example.com > Websites & Domains > example.com > Apache & nginx Settings > Additional Nginx directives
Add/increase the following values in the 'http' section in the
fastcgi_buffers 8 128k;
Restart 'php-fpm', 'apache' and 'nginx' services.
Note: Setting value for
max_execution_time parameter in PHP settings of a domain in Domains > example.com > PHP Settings will set the same value for
FcgidIOTimeout parameter in virtual host configuration.