From df79901f8b488fe707fcd424f705948b94195dda Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Fri, 17 Aug 2018 08:00:38 +0300 Subject: [PATCH] Improve compression support --- CHANGELOG.md | 9 +++++++++ .../templates/nginx-conf.d/matrix-riot-web.conf.j2 | 3 +++ .../templates/nginx-conf.d/matrix-synapse.conf.j2 | 3 +++ roles/matrix-server/templates/synapse/homeserver.yaml.j2 | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10ff3ae9..f9401b9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # 2018-08-17 +## Compression improvements + +Shifted Matrix Synapse compression from happening in the Matrix Synapse, +to happening in the nginx proxy that's in front of it. + +Additionally, `riot-web` also gets compressed now (in the nginx proxy), +which drops the initial page load's size from 5.31MB to 1.86MB. + + ## Disabling some unnecessary Synapse services The following services are not necessary, so they have been disabled: 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 43067514..3affc577 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 @@ -33,6 +33,9 @@ server { server_tokens off; root /dev/null; + gzip on; + gzip_types text/plain text/html application/json application/javascript text/css image/x-icon font/ttf image/gif; + ssl_certificate {{ matrix_ssl_certs_path }}/live/{{ hostname_riot }}/fullchain; ssl_certificate_key {{ matrix_ssl_certs_path }}/live/{{ hostname_riot }}/privkey; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 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 706a41a5..f22eebcc 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 @@ -33,6 +33,9 @@ server { server_tokens off; root /dev/null; + gzip on; + gzip_types text/plain text/html application/json; + ssl_certificate {{ matrix_ssl_certs_path }}/live/{{ hostname_matrix }}/fullchain; ssl_certificate_key {{ matrix_ssl_certs_path }}/live/{{ hostname_matrix }}/privkey; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; diff --git a/roles/matrix-server/templates/synapse/homeserver.yaml.j2 b/roles/matrix-server/templates/synapse/homeserver.yaml.j2 index 106c8f16..6c77af18 100644 --- a/roles/matrix-server/templates/synapse/homeserver.yaml.j2 +++ b/roles/matrix-server/templates/synapse/homeserver.yaml.j2 @@ -164,7 +164,7 @@ listeners: resources: - names: [client] - compress: true + compress: false # Turn on the twisted ssh manhole service on localhost on the given # port.