From e5a1c34e216c61406215c2e9da8fc8b14caa2370 Mon Sep 17 00:00:00 2001 From: Hadrien Huvelle Date: Thu, 29 Jun 2023 10:36:26 +0200 Subject: [PATCH] [IMP] Added Nginx cache cusomisation capabilities --- 9.0/docker-entrypoint.sh | 9 +++++++++ 9.0/templates/nginx.conf.tmpl | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/9.0/docker-entrypoint.sh b/9.0/docker-entrypoint.sh index a078435..ac1c7bb 100755 --- a/9.0/docker-entrypoint.sh +++ b/9.0/docker-entrypoint.sh @@ -7,4 +7,13 @@ echo "${NGX_HTPASSWD}" > /etc/nginx/htpasswd /usr/local/bin/confd -onetime -backend env +if [[ -z "${NGX_SPECIFIC_CACHE}" ]] +then + echo "CREATE empty /etc/nginx/specific_cache.conf" + touch /etc/nginx/specific_cache.conf +else + echo "OVERRIDE /etc/nginx/specific_cache.conf" + echo "${NGX_SPECIFIC_CACHE}" > /etc/nginx/specific_cache.conf +fi + exec "$@" diff --git a/9.0/templates/nginx.conf.tmpl b/9.0/templates/nginx.conf.tmpl index 10c2efa..0aa46bf 100644 --- a/9.0/templates/nginx.conf.tmpl +++ b/9.0/templates/nginx.conf.tmpl @@ -77,7 +77,7 @@ http { proxy_max_temp_file_size 2048m; proxy_temp_file_write_size 64k; - proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:10m inactive=60m; + proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:100m inactive=60m; include /etc/nginx/proxy_headers.conf; @@ -148,6 +148,8 @@ http { try_files =404 @cached; } + include /etc/nginx/specific_cache.conf; + # warning: /web/content reads ir.attachment, it would not be safe to # cache other files than .js / .css which can depend on users rights location ~* ^/web/content/.+\.(js|css)$ {