nginx error 504: "Connection timed out"
Several 504 errors are displayed on SSL pages or it takes a long time to load the website. The problem can be corrected for a short time by the service & #8218; apache & #8216; is restarted, but it keeps coming on.
In the domain logs under
/var/www/vhosts/my.domain.com/logs/ the following error can be found:
2013/11/15 03:32:13 [error] 12699#0: * 5042589 upstream time out (110: Connection timed out) while reading response header from upstream, client: 220.127.116.11, server: my.domain.com, request: "GET /wp-login.php HTTP / 1.0", upstream: "https://18.104.22.168:7081/wp-login.php", host: "my.domain.com", referrer: "https: // my.domain.com/register/ "
The cause of the timeout error is often issues with the backend connection serving the content. To fix the problem, you need to find out which configuration you are using.
- At nginx as a proxy (php-fpm disabled)To apply the settings globally, you must increase the following timeout values by using the file
/etc/nginx/conf.d/timeout.confadd and service & #8217; nginx & #8216; start anew:
# cat /etc/nginx/conf.d/timeout.conf
proxy_connect_timeout 600; proxy_send_timeout 600; proxy_read_timeout 600; send_timeout 600;
If you can only increase the timeout settings per domain, you can do so in the following ways:
Plesk> Subscriptions> your.domain.com> Web Sites & Domains> Web Server Settings - add the lines Additional nginx instructions in addition
- At nginx + FastCGI (php-fpm enabled)Increase the setting
Plesk> Subscriptions> test.com> Sites & Domains> test.com> PHP Settings & #8211; Set the following:
max_execution_time = 300
Change the parameter
request_terminate_timeout(commented by default) in the file
request_terminate_timeout = 300
Add the variable
fastcgi_read_timeoutwithin the nginx virtual host configuration:
Plesk> Subscriptions> your.domain.com> Web Sites & Domains> Web Server Settings> Additional nginx statements
Add in section & #8218; http & #8216; the file
/etc/nginx/nginx.confadd or increase the following values:
fastcgi_buffers 8 128k; fastcgi_buffer_size 256k;
Start both & #8218; apache & #8216; as well & #8217; nginx & #8216; New.