Website hangs: Gateway timeout 504

Created:

2017-03-24 18:44:28 UTC

Modified:

2017-08-08 13:44:15 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Website hangs: Gateway timeout 504

Applicable to:

  • Plesk for Linux

Symptoms

MySQL-based website is not accessible. It hangs on loading, finishing with an error:

Gateway timeout 504

Or it fails to load, without hanging:

Error establishing a database connection

Maximum MySQL connections limit is the following:

# grep max_connections /etc/my.cnf
max_connections=1500

Maximum web server processes limit is the following:

# grep max_children /opt/plesk/php/5.6/etc/php-fpm.d/example.com.conf
pm.max_children = 2000

Cause

MySQL maximum connections limit is reached. New connections from web server processes are not received by MySQL server.

Resolution

Set maximum web server children processes limit less than maximum MySQL server connections limit.

For example:

# grep max_connections /etc/my.cnf
max_connections=1500

# grep max_children /opt/plesk/php/5.6/etc/php-fpm.d/example.com.conf
pm.max_children = 200

Have more questions? Submit a request
Please sign in to leave a comment.