From 3a31ef4a176394e6509f56ac23d22f1fe7f49802 Mon Sep 17 00:00:00 2001 From: Lucas Ayres Date: Fri, 8 Mar 2019 12:40:38 -0300 Subject: [PATCH] Enable Leverage Browser Caching --- nginx.tmpl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nginx.tmpl b/nginx.tmpl index a9fc479..6d1241d 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -57,6 +57,16 @@ map $scheme $proxy_x_forwarded_ssl { https on; } +# Expires map +map $sent_http_content_type $expires { + default off; + ~application/ 30d; + ~text/ 30d; + ~audio/ 365d; + ~video/ 365d; + ~image/ 365d; +} + gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; log_format vhost '$host $remote_addr - $remote_user [$time_local] ' @@ -210,6 +220,8 @@ server { {{ end }} access_log /var/log/nginx/access.log vhost; + expires $expires; + {{ if eq $network_tag "internal" }} # Only allow traffic from internal clients include /etc/nginx/network_internal.conf; @@ -308,6 +320,8 @@ server { {{ end }} access_log /var/log/nginx/access.log vhost; + expires $expires; + {{ if eq $network_tag "internal" }} # Only allow traffic from internal clients include /etc/nginx/network_internal.conf;