Articles in this section

How to change the maximum attachment size for webmail on the Linux Plesk server?

kb: how-to

Question

How to change the maximum attachment size for webmail on the Linux Plesk server?

Answer

RoundCube

The steps below will increase the maximum upload size to 1024M, feel free to adapt based on your needs:

  1. Connect to the server via SSH.
  2. Create a directory for custom templates:

# mkdir -p /usr/local/psa/admin/conf/templates/custom/webmail/

  1. Copy original files to the created directory:

# cp /usr/local/psa/admin/conf/templates/default/webmail/nginxWebmailPartial.php /usr/local/psa/admin/conf/templates/custom/webmail/
# cp /usr/local/psa/admin/conf/templates/default/webmail/roundcube.php /usr/local/psa/admin/conf/templates/custom/webmail/

  1. Open /usr/local/psa/admin/conf/templates/custom/webmail/nginxWebmailPartial.php in a text editor (e.g., vi) and increase the value of client_max_body_size (e.g., 1024m), it should look like this:

# grep client_max_body_size /usr/local/psa/admin/conf/templates/custom/webmail/nginxWebmailPartial.php
client_max_body_size 1024m;

  1. Edit the appropriate webmail file to increase the value of FcgidMaxRequestLen:

# grep FcgidMaxRequestLen /usr/local/psa/admin/conf/templates/custom/webmail/roundcube.php
FcgidMaxRequestLen 1073741824

  1. Rebuild configuration files:

# /usr/local/psa/admin/bin/httpdmng --reconfigure-all

  1. Edit the appropriate PHP configuration file to increase the values of post_max_size and upload_max_filesize:

# cat /etc/psa-webmail/roundcube/php.ini
...
post_max_size = 1024M
upload_max_filesize = 1024M

  1. Open /etc/httpd/conf.d/fcgid.conf and increase the value of FcgidIOTimeout:

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

Horde
  1. Connect to the server via SSH.

    Note: if direct SSH access to the server is not possible, contact server administrator for further assistance.

  2. Change the PHP settings as follows in /etc/psa-webmail/horde/horde/php.ini:

    upload_max_filesize = 256M
    post_max_size = 256M

  3. Modify also horde attach_size_limit value at /etc/psa-webmail/horde/imp/conf.php, it should be set to 0 (unlimited):

    # grep attach_size_limit /etc/psa-webmail/horde/imp/conf.php
    $conf['compose']['attach_size_limit'] = 0;

    Note: Set higher values if it is required.

  4. Modify templates and apply the change to all domains, perform the next steps. Create the custom templates directory for webmail:

    # mkdir -p /usr/local/psa/admin/conf/templates/custom/webmail

  5. Then copy the template to the custom templates folder:

    # cp /usr/local/psa/admin/conf/templates/default/webmail/horde.php /usr/local/psa/admin/conf/templates/custom/webmail/

  6. Edit the FcgidMaxRequestLen directive in the custom template:

    # sed -i '/FcgidMaxRequestLen/c\FcgidMaxRequestLen 268435456' /usr/local/psa/admin/conf/templates/custom/webmail/horde.php

  7. Add the following line to /usr/local/psa/admin/conf/templates/custom/webmail/nginxWebmailPartial.php

    proxy_request_buffering off;

  8. Apply changes within the template to all webmails using the next command:

    # plesk repair web -server

Note: In case there is server-wide ModSecurity limitation or timeouts caused by bandwidth, refer to the additional steps below:

In case the server uses ModSecurity
  1. Log in to Plesk.

  2. Navigate to Tools & settings > Web Application Firewall (ModSecurity) > Settings > Custom directives:

  3. Add the directive

    SecResponseBodyLimit 268435456

  4. Press Apply

Bandwidth limitations are causing a timeout
  1. Connect to the server via SSH.

  2. Backup the apache2 config file, increase the timeout delay up to 2 minutes and restart the apache 2 server using the next commands:

    • for Rhel-based OS:

      # cp /etc/httpd/conf.d/fcgid.conf{,.bkp}

      # sed -i '/FcgidIOTimeout/c\ FcgidIOTimeout 120' /etc/httpd/conf.d/fcgid.conf

      # systemctl restart httpd2

    • for Debian-based OS:

      # cp /etc/apache2/mods-enabled/fcgid.conf{,.bkp}

      # sed -i '/FcgidIOTimeout/c\ FcgidIOTimeout 120' /etc/apache2/mods-enabled/fcgid.conf

      # systemctl restart apache2

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.