Question
How to change the maximum attachment size for webmail on the Linux Plesk server?
Answer
RoundCube
-
Connect to the server via SSH
Note: if direct SSH access to the server is not possible, contact the server administrator for further assistance.
-
Change the PHP settings as follows in
/etc/psa-webmail/roundcube/php.ini
:upload_max_filesize = 256M
post_max_size = 256MNote: Set higher values if it is required.
-
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
-
Then copy the template to the custom templates folder:
# cp /usr/local/psa/admin/conf/templates/default/webmail/roundcube.php /usr/local/psa/admin/conf/templates/custom/webmail/
-
Edit the
FcgidMaxRequestLen
directive in the custom template:# sed -i ‘/FcgidMaxRequestLen/cFcgidMaxRequestLen 268435456’ /usr/local/psa/admin/conf/templates/custom/webmail/roundcube.php
-
Apply changes within the template to all webmails using the next command:
# plesk repair web -server
Horde
-
Connect to the server via SSH
Note: if direct SSH access to the server is not possible, contact server administrator for further assistance.
-
Change the PHP settings as follows in
/etc/psa-webmail/horde/horde/php.ini
:upload_max_filesize = 256M
post_max_size = 256M -
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. -
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
-
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/
-
Edit the
FcgidMaxRequestLen
directive in the custom template:# sed -i ‘/FcgidMaxRequestLen/cFcgidMaxRequestLen 268435456’ /usr/local/psa/admin/conf/templates/custom/webmail/horde.php
-
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
-
Log in to Plesk.
-
Navigate to Tools & settings > Web Application Firewall (ModSecurity) > Settings > Custom directives:
-
Add the directive
SecResponseBodyLimit 268435456
-
Press Apply
Bandwidth limitations are causing a timeout
-
Connect to the server via SSH
- 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