From 22564c36e8ffd71f455826cf0ad30d9ad41a2950 Mon Sep 17 00:00:00 2001 From: Buster Neece Date: Mon, 30 Jan 2023 00:32:59 -0600 Subject: [PATCH] Re-implement nginx gzip compression. --- util/docker/web/nginx/nginx.conf.tmpl | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/util/docker/web/nginx/nginx.conf.tmpl b/util/docker/web/nginx/nginx.conf.tmpl index bd7e7451b..3541eeb32 100644 --- a/util/docker/web/nginx/nginx.conf.tmpl +++ b/util/docker/web/nginx/nginx.conf.tmpl @@ -61,6 +61,46 @@ http { https on; } + # Enable Gzip compression + gzip on; + + gzip_vary on; + gzip_buffers 128 4k; + + # Compression level (1-9) + gzip_comp_level 5; + + # Don't compress anything under 256 bytes + gzip_min_length 256; + + # Compress output of these MIME-types + gzip_types + application/atom+xml + application/javascript + application/json + application/rss+xml + application/vnd.ms-fontobject + application/x-font-ttf + application/x-font-opentype + application/x-font-truetype + application/x-javascript + application/x-web-app-manifest+json + application/xhtml+xml + application/xml + font/eot + font/opentype + font/otf + image/svg+xml + image/x-icon + image/vnd.microsoft.icon + text/css + text/plain + text/javascript + text/x-component; + + # Disable gzip for bad browsers + gzip_disable "MSIE [1-6]\.(?!.*SV1)"; + include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }