From 4c06ae5b2de5b2fd4c406ea5632db63dd2392992 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 20 Jan 2020 12:27:21 +0100 Subject: [PATCH] One variable to manage the max attachment size. --- library/roles/roundcube/defaults/main.yml | 3 +++ library/roles/roundcube/templates/nginx-virthost.conf.j2 | 3 +++ library/roles/roundcube/vars/main.yml | 7 +++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/library/roles/roundcube/defaults/main.yml b/library/roles/roundcube/defaults/main.yml index 142478eb..b2ca7ddf 100644 --- a/library/roles/roundcube/defaults/main.yml +++ b/library/roles/roundcube/defaults/main.yml @@ -137,3 +137,6 @@ roundcube_identity_smtp_name: identity_smtp roundcube_additional_plugins: [] #roundcube_additional_plugins: # - identity_smtp + +# In Megabytes. This affects both the nginx/apache and php configurations +roundcube_max_attachments_size: 5 diff --git a/library/roles/roundcube/templates/nginx-virthost.conf.j2 b/library/roles/roundcube/templates/nginx-virthost.conf.j2 index 7d339866..6bba5efb 100644 --- a/library/roles/roundcube/templates/nginx-virthost.conf.j2 +++ b/library/roles/roundcube/templates/nginx-virthost.conf.j2 @@ -41,6 +41,9 @@ server { index index.php; + # This determines the max size of attachments. Configure the corresponding php options accordingly + client_max_body_size {{ nginx_client_max_body_size }}; + # Add headers to serve security related headers # Before enabling Strict-Transport-Security headers please read into this # topic first. diff --git a/library/roles/roundcube/vars/main.yml b/library/roles/roundcube/vars/main.yml index 0d7c4810..722e7008 100644 --- a/library/roles/roundcube/vars/main.yml +++ b/library/roles/roundcube/vars/main.yml @@ -1,7 +1,10 @@ --- nginx_use_common_virthost: False +nginx_client_max_body_size: '{{ roundcube_max_attachments_size * 2 }}M' + phpfpm_default_user: '{{ roundcube_user }}' phpfpm_default_pool_name: roundcube +phpfpm_default_memory_limit: '{{ roundcube_max_attachments_size * 4 }}M' redis_install: False http_port: 80 https_port: 443 @@ -29,8 +32,8 @@ phpfpm_default_memory_limit: "64M" php_global_settings: - { option: 'zlib.output_compression', value: 'Off' } - - { option: 'post_max_size', value: '6M' } - - { option: 'upload_max_filesize', value: '5M' } + - { option: 'post_max_size', value: '{{ roundcube_max_attachments_size }}M' } + - { option: 'upload_max_filesize', value: '{{ roundcube_max_attachments_size }}M' } - { option: 'session.auto_start', value: 'Off' } - { option: 'suhosin.session.encrypt', value: 'Off' } - { option: 'session.gc_maxlifetime', value: '21600' }