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 one of the following errors:
504 Gateway Time-out
502 Bad GatewayWhen 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.log
contains 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"
CONFIG_TEXT: 2024/03/01 11:32:42 [error] 3156232#0: *6740627 upstream prematurely closed connection while reading response header from upstream, client: 203.0.113.2, server: webmail.example.com, request: "POST /roundcube/?_task=login HTTP/2.0", upstream: "https://203.0.113.1:7081/roundcube/?_task=login", host: "webmail.example.com", referrer: "https://webmail.example.com/roundcube/?_task=login&_err=session"
CONFIG_TEXT: 2024/03/01 11:32:43 [error] 3156232#0: *6738941 connect() failed (111: Connection refused) while connecting to upstream, client: 203.0.113.2, server: webmail.example.com, request: "POST /?_task=mail&_action=refresh HTTP/2.0", upstream: "https://203.0.113.1:7081/?_task=mail&_action=refresh", host: "webmail.example.com", referrer: "https://webmail.example.com/?_task=mail&_mbox=INBOX"
- A check on the
FcgidIOTimeout
value in the Apache config file/etc/httpd/conf.d/fcgid.conf
or (/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.ini
file of the used webmail client with your favorite command-line text editor and increasemax_execution_time
andmax_input_time
as necessary:Note: The values correspond to seconds, the recommended value for
max_execution_time
is 300, the recommended value formax_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:
/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.conf
and increaseFcgidIOTimeout
value:# grep FcgidIOTimeout /etc/httpd/conf.d/fcgid.conf
FcgidIOTimeout 300 -
Edit the Nginx configuration file
/etc/nginx/nginx.conf
adding 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_time
andmax_input_time
as 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.conf
and increaseFcgidIOTimeout
value:# grep FcgidIOTimeout /etc/apache2/mods-enabled/fcgid.conf
FcgidIOTimeout 300 -
Edit the Nginx configuration file
/etc/nginx/nginx.conf
adding 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
0 comments
Please sign in to leave a comment.