Articles in this section

Webmail for domain in Plesk shows 504 Gateway Time-out error

Plesk for Linux kb: technical ext: kolab

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.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"

  • 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 = 30

    For 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 = 30

    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 = 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

For Plesk on RHEL / CentOS / CloudLinux
  1. Connect to the server via SSH

  2. Open the corresponding php.ini file of the used webmail client with your favorite command-line text editor and increase max_execution_time and max_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: /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

  3. Edit the Apache configuration /etc/httpd/conf.d/fcgid.conf and increase FcgidIOTimeout value:

    # grep FcgidIOTimeout /etc/httpd/conf.d/fcgid.conf
    FcgidIOTimeout 300

  4. Edit the Nginx configuration file /etc/nginx/nginx.conf adding the following directives inside the http {} code section:

    proxy_send_timeout 300s;
    proxy_read_timeout 300s;
    fastcgi_send_timeout 300s;
    fastcgi_read_timeout 300s;

  5. Reload the Apache service:

    # service httpd reload

  6. Reload the Nginx service:

    # service nginx reload

For Plesk on Debian / Ubuntu
  1. Connect to the server via SSH

  2. Open the corresponding php.ini file of the used webmail client with your favorite command-line text editor and increase max_execution_time and max_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

  3. Edit the Apache configuration /etc/apache2/mods-enabled/fcgid.conf and increase FcgidIOTimeout value:

    # grep FcgidIOTimeout /etc/apache2/mods-enabled/fcgid.conf
    FcgidIOTimeout 300

  4. Edit the Nginx configuration file /etc/nginx/nginx.conf adding the following directives inside the http {} code section:

    proxy_send_timeout 300s;
    proxy_read_timeout 300s;
    fastcgi_send_timeout 300s;
    fastcgi_read_timeout 300s;

  5. Reload the Apache service:

    # service apache2 reload

  6. Reload the Nginx service:

    # service nginx reload

Was this article helpful?

Comments

1 comment
Date Votes

Please sign in to leave a comment.