From 1cd227b6991467ebb461193343430be3209383a3 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sat, 12 Aug 2017 15:39:21 +0300 Subject: [PATCH] Increase max body size for the nginx proxy Otherwise, we can't support large media file uploads. --- .../nginx-conf.d/matrix-riot-web.conf.j2 | 2 +- .../nginx-conf.d/matrix-synapse.conf.j2 | 22 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/roles/matrix-server/templates/nginx-conf.d/matrix-riot-web.conf.j2 b/roles/matrix-server/templates/nginx-conf.d/matrix-riot-web.conf.j2 index ac6d735ca..779aad0ae 100644 --- a/roles/matrix-server/templates/nginx-conf.d/matrix-riot-web.conf.j2 +++ b/roles/matrix-server/templates/nginx-conf.d/matrix-riot-web.conf.j2 @@ -34,4 +34,4 @@ server { proxy_pass http://riot:8765; proxy_set_header X-Forwarded-For $remote_addr; } -} \ No newline at end of file +} diff --git a/roles/matrix-server/templates/nginx-conf.d/matrix-synapse.conf.j2 b/roles/matrix-server/templates/nginx-conf.d/matrix-synapse.conf.j2 index 4db628f6a..be3988e17 100644 --- a/roles/matrix-server/templates/nginx-conf.d/matrix-synapse.conf.j2 +++ b/roles/matrix-server/templates/nginx-conf.d/matrix-synapse.conf.j2 @@ -15,10 +15,10 @@ server { } server { - listen 443 ssl http2; - listen [::]:443 ssl http2; + listen 443 ssl http2; + listen [::]:443 ssl http2; - server_name {{ hostname_matrix }}; + server_name {{ hostname_matrix }}; server_tokens off; root /dev/null; @@ -30,8 +30,14 @@ server { ssl_prefer_server_ciphers on; ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; - location /_matrix { - proxy_pass http://synapse:8008; - proxy_set_header X-Forwarded-For $remote_addr; - } -} \ No newline at end of file + location /_matrix { + proxy_pass http://synapse:8008; + proxy_set_header X-Forwarded-For $remote_addr; + + # These are intentionally large. + # Note that Synapse enforces its own limits, which are smaller. + client_body_buffer_size 25M; + client_max_body_size 100M; + proxy_max_temp_file_size 0; + } +}