From 1bd84561f145b5b893667336e323efbf284ab247 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Thu, 22 Oct 2015 11:37:19 +0200 Subject: [PATCH] Add rules for compression and cache expiry Refs flarum/core#514. --- scripts/environment.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/scripts/environment.sh b/scripts/environment.sh index 1f99279..a18e433 100644 --- a/scripts/environment.sh +++ b/scripts/environment.sh @@ -49,6 +49,40 @@ block=" location ~ /\.ht { deny all; } + + location ~* \.html$ { + expires -1; + } + + location ~* \.(css|js|gif|jpe?g|png)$ { + expires 1M; + add_header Pragma public; + add_header Cache-Control \"public, must-revalidate, proxy-revalidate\"; + } + + gzip on; + gzip_http_version 1.1; + gzip_vary on; + gzip_comp_level 6; + gzip_proxied any; + gzip_types application/atom+xml \ + application/javascript \ + application/json \ + application/vnd.ms-fontobject \ + application/x-font-ttf \ + application/x-web-app-manifest+json \ + application/xhtml+xml \ + application/xml \ + font/opentype \ + image/svg+xml \ + image/x-icon \ + text/css \ + text/html \ + text/plain \ + text/xml; + gzip_buffers 16 8k; + gzip_disable "MSIE [1-6]\.(?!.*SV1)"; + } "