Question
How to change the maximum attachment size for webmail on the Linux Plesk server?
Answer
The steps below will increase the maximum upload size to 1024M, feel free to adapt based on your needs:
- Connect to the server via SSH.
- Create a directory for custom templates:
# mkdir -p /usr/local/psa/admin/conf/templates/custom/webmail/
- 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/
- Open
/usr/local/psa/admin/conf/templates/custom/webmail/nginxWebmailPartial.php
in a text editor (e.g.,vi
) and increase the value ofclient_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;
- 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
- Rebuild configuration files:
# /usr/local/psa/admin/bin/httpdmng --reconfigure-all
- Edit the appropriate PHP configuration file to increase the values of
post_max_size
andupload_max_filesize
:
# cat /etc/psa-webmail/roundcube/php.ini
...
post_max_size = 1024M
upload_max_filesize = 1024M
- Open
/etc/httpd/conf.d/fcgid.conf
and increase the value ofFcgidIOTimeout
:
# grep FcgidIOTimeout /etc/httpd/conf.d/fcgid.conf
FcgidIOTimeout 300
-
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
:CONFIG_TEXT: 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/c\FcgidMaxRequestLen 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:
-
Log in to Plesk.
-
Navigate to Tools & settings > Web Application Firewall (ModSecurity) > Settings > Custom directives:
-
Add the directive
CONFIG_TEXT: SecResponseBodyLimit 268435456
-
Press Apply
-
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
-
Comments
0 comments
Please sign in to leave a comment.