修改php上传限制
vi /etc/php/8.1/fpm/php.ini
修改以下2处,upload_max_filesize和post_max_size,需要注意的是post_max_size大于等于upload_max_filesize。
upload_max_filesize = 1024M;
post_max_size = 1200M;
修改postfix附件大小限制
postconf -e message_size_limit='1073741824'
postconf -e mailbox_size_limit='1073741824'
修改roundcube目录下.htaccess文件
root@mail:~# vi /opt/www/roundcubemail/.htaccess
不同系统可以看官方文档提示
在 RHEL/CentOS 系统上,此文件路径为 /var/www/roundcubemail/.htaccess
在 Debian/Ubuntu 系统上,此文件路径为 /usr/share/apache2/roundcubemail/.htaccess 或者 /opt/www/roundcubemail/.htaccess.
在 FreeBSD 系统上,此文件路径为 /usr/local/www/roundcubemail/.htaccess
在 OpenBSD 系统上,此文件路径为 /var/www/roundcubemail/.htaccess
root@mail:~# tail -n 5 /opt/www/roundcubemail/.htaccess
php_value memory_limit 1500M
php_value upload_max_filesize 1024M
php_value post_max_size 1200M
修改nginx配置
cat /etc/nginx/conf-enabled/client_max_body_size.conf
client_max_body_size 1024m;
重启服务
root@mail:~# service php8.1-fpm restart
root@mail:~# /etc/init.d/postfix restart
root@mail:~# /usr/sbin/nginx -s reload
至此已按照官方文档对邮件附件大小进行修改,发现 web端还是提示”上传附件最大从10M变成了不超过 11 MB“
修改一下配置
vi /opt/www/roundcubemail/config/config.inc.php
$config['max_message_size'] = '15M'
将其改为100M测试一下,web端显示变成了75M,看来roundcube是取max_message_size的75%作为附件大小限制,那么我们想限定附件大小1024M,设为1366M即可。