summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Porte <microjoe@microjoe.org>2017-09-14 19:40:49 +0200
committerRomain Porte <microjoe@microjoe.org>2017-09-14 19:40:49 +0200
commitffc5c412c9f1a07bcb00edd07e0f3c5923ddf4e5 (patch)
tree41f3ce65c0219adde76ae866f19644bf7b978e7b
parent47ffcfda5618d93cb414291b08fb1480ff70dced (diff)
downloadMicroJoe.nginx-staticwebsite-ffc5c412c9f1a07bcb00edd07e0f3c5923ddf4e5.tar.gz
MicroJoe.nginx-staticwebsite-ffc5c412c9f1a07bcb00edd07e0f3c5923ddf4e5.zip
Introduced deactivable caching
-rw-r--r--defaults/main.yml1
-rw-r--r--templates/nginx.j22
2 files changed, 3 insertions, 0 deletions
diff --git a/defaults/main.yml b/defaults/main.yml
index 3f67b9d..e5d061a 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -8,6 +8,7 @@ nginx_customize: ""
nginx_auth_file: ""
nginx_enable_http2: true
+nginx_cache_static: true
letsencrypt_wellknown: /var/www/letsencrypt
letsencrypt_activate: false
diff --git a/templates/nginx.j2 b/templates/nginx.j2
index 47e03a2..df0e6ac 100644
--- a/templates/nginx.j2
+++ b/templates/nginx.j2
@@ -62,6 +62,7 @@ server {
deny all;
}
+ {% if nginx_cache_static %}
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
# cache static assets and compress them
gzip on;
@@ -69,6 +70,7 @@ server {
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
+ {% endif %}
{{ nginx_custom }}
}