Symptoms
-
Unable to log in to webmail service or performing some operations once the user is already logged in to webmail service, the following error is shown:
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 ()
-
In Nginx log fileÂ
/var/log/nginx/error.log
 one of the following error messages might be shown:[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"
[error] 13148#0: *515049 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/importMailbox?jsonhtml=1&token=... HTTP/2.0", upstream: "https://203.0.113.1:7081/services/ajax.php/imp/importMailbox?jsonhtml=1&token=...", host: "webmail.example.com", referrer: "https://webmail.example.com/imp/dynamic.php?page=mailbox"
Cause
Insufficient timeout values are configured.
Resolution
-
Connect to the server via SSH
-
Edit the Webmail PHP.ini file and increase
max_execution_time
andmax_input_time
 values: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 = 300For 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 = 300For 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 and increase
FcgidIOTimeout
 value:For CentOS / RedHat OS:Â
/etc/httpd/conf.d/fcgid.conf
# grep FcgidIOTimeout /etc/httpd/conf.d/fcgid.conf
FcgidIOTimeout 300For Ubuntu/Debian OS:
/etc/apache2/mods-enabled/fcgid.conf
# 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 Apache service:
For CentOS / RedHat OS:
# service httpd reload
For Ubuntu/Debian OS:
# service apache2 reload
-
Reload Nginx service:
# service nginx reload