Applicable to:
- Plesk for Linux
Symptoms
-
Performing some operations after being logged into webmail (or being unable to log into webmail at all) results in the following error in a browser:
504 Gateway Time-out
When importing a mailbox via webmail service, the following error is shown in the browser console:
Failed to load resource: the server responded with a status of 504 ()
Connection Error (Failed to reach the server)!
-
The Nginx log file
/var/log/nginx/error.logcontains error messages that are similar to the following:CONFIG_TEXT: 2023/01/07 11:32:42 [error] 12026#0: *1721 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 203.0.113.2, server: webmail.example.com, request: "POST /services/ajax.php/imp/viewPort HTTP/1.1", upstream: "http://203.0.113.1:7080/services/ajax.php/imp/viewPort", host: "webmail.example.com", referrer: "http://webmail.example.com/imp/dynamic.php?page=mailbox"
- A check on the
FcgidIOTimeoutvalue in the Apache config file/etc/httpd/conf.d/fcgid.confor (/etc/apache2/mods-enabled/fcgid.conf) provides a result that is similar to to the following:
# grep FcgidIOTimeout /etc/httpd/conf.d/fcgid.conf
FcgidIOTimeout 45# grep FcgidIOTimeout /etc/apache2/mods-enabled/fcgid.conf
FcgidIOTimeout 45 - A check on the max_input_time and max_execution_time values in the webmail client configuration files provides results that are similar to the following:
For Horde:
/etc/psa-webmail/horde/horde/php.ini# egrep "max_execution_time|max_input_time" /etc/psa-webmail/horde/horde/php.ini
max_input_time = 60
max_execution_time = 30For RoundCube:
/etc/psa-webmail/roundcube/php.ini# egrep "max_execution_time|max_input_time" /etc/psa-webmail/roundcube/php.ini
max_input_time = 60
max_execution_time = 30For Plesk Premium Mail:
/usr/local/psa/var/modules/kolab/webmail/php.ini# egrep "max_execution_time|max_input_time" /usr/local/psa/var/modules/kolab/webmail/php.ini
max_input_time = 60
max_execution_time = 30
Cause
Insufficient timeout values are configured in the web server configuration files and/or within the webmail client configuration files and therefore bigger requests that require more time to be executed are timing out.
Resolution
-
Connect to the server via SSH
-
Open the corresponding
php.inifile of the used webmail client with your favorite command-line text editor and increasemax_execution_timeandmax_input_timeas necessary:Note: The values correspond to seconds, the recommended value for
max_execution_timeis 300, the recommended value formax_input_timeis 600-
For Horde:
/etc/psa-webmail/horde/horde/php.ini# egrep "max_execution_time|max_input_time" /etc/psa-webmail/horde/horde/php.ini
max_input_time = 600
max_execution_time = 300 -
For RoundCube:
/etc/psa-webmail/roundcube/php.ini# egrep "max_execution_time|max_input_time" /etc/psa-webmail/roundcube/php.ini
max_input_time = 600
max_execution_time = 300 -
For Plesk Premium Mail:
/usr/local/psa/var/modules/kolab/webmail/php.ini# egrep "max_execution_time|max_input_time" /usr/local/psa/var/modules/kolab/webmail/php.ini
max_input_time = 600
max_execution_time = 300
-
-
Edit the Apache configuration
/etc/httpd/conf.d/fcgid.confand increaseFcgidIOTimeoutvalue:# grep FcgidIOTimeout /etc/httpd/conf.d/fcgid.conf
FcgidIOTimeout 300 -
Edit the Nginx configuration file
/etc/nginx/nginx.confadding the following directives inside thehttp {}code section:proxy_send_timeout 300s;
proxy_read_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s; -
Reload the Apache service:
# service httpd reload
-
Reload the Nginx service:
# service nginx reload
-
Connect to the server via SSH
-
Open the corresponding php.ini file of the used webmail client with your favorite command-line text editor and increase
max_execution_timeandmax_input_timeas necessary:Note: The values correspond to seconds, the recommended value for max_execution_time is 300, the recommended value for max_input_time is 600
-
For Horde:
/etc/psa-webmail/horde/horde/php.ini# egrep "max_execution_time|max_input_time" /etc/psa-webmail/horde/horde/php.ini
max_input_time = 600
max_execution_time = 300 -
For RoundCube:
/etc/psa-webmail/roundcube/php.ini# egrep "max_execution_time|max_input_time" /etc/psa-webmail/roundcube/php.ini
max_input_time = 600
max_execution_time = 300 -
For Plesk Premium Mail:
/opt/psa/var/modules/kolab/webmail/php.ini# egrep "max_execution_time|max_input_time" /opt/psa/var/modules/kolab/webmail/php.ini
max_input_time = 600
max_execution_time = 300
-
-
Edit the Apache configuration
/etc/apache2/mods-enabled/fcgid.confand increaseFcgidIOTimeoutvalue:# grep FcgidIOTimeout /etc/apache2/mods-enabled/fcgid.conf
FcgidIOTimeout 300 -
Edit the Nginx configuration file
/etc/nginx/nginx.confadding the following directives inside thehttp {}code section:proxy_send_timeout 300s;
proxy_read_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s; -
Reload the Apache service:
# service apache2 reload
-
Reload the Nginx service:
# service nginx reload
Comments
Tried all that but nothing helped
Please sign in to leave a comment.