From e9f90f438fae242f1ee87e37d10ce3df5fb461d2 Mon Sep 17 00:00:00 2001 From: Proto Date: Mon, 1 Nov 2021 12:18:59 +0000 Subject: [PATCH] Inactive to match CACHE_MAX_AGE (#139) * Set innactive time to match the CACHE_MAX_AGE env var * setup script copy for max age --- overlay/etc/nginx/conf.d/20_proxy_cache_path.conf | 2 +- overlay/hooks/entrypoint-pre.d/10_setup.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/overlay/etc/nginx/conf.d/20_proxy_cache_path.conf b/overlay/etc/nginx/conf.d/20_proxy_cache_path.conf index d66bdfa..e1a990b 100644 --- a/overlay/etc/nginx/conf.d/20_proxy_cache_path.conf +++ b/overlay/etc/nginx/conf.d/20_proxy_cache_path.conf @@ -1 +1 @@ -proxy_cache_path /data/cache/cache levels=2:2 keys_zone=generic:CACHE_INDEX_SIZE inactive=200d max_size=CACHE_DISK_SIZE loader_files=1000 loader_sleep=50ms loader_threshold=300ms use_temp_path=off; +proxy_cache_path /data/cache/cache levels=2:2 keys_zone=generic:CACHE_INDEX_SIZE inactive=CACHE_MAX_AGE max_size=CACHE_DISK_SIZE loader_files=1000 loader_sleep=50ms loader_threshold=300ms use_temp_path=off; diff --git a/overlay/hooks/entrypoint-pre.d/10_setup.sh b/overlay/hooks/entrypoint-pre.d/10_setup.sh index 404ca6a..481ad40 100644 --- a/overlay/hooks/entrypoint-pre.d/10_setup.sh +++ b/overlay/hooks/entrypoint-pre.d/10_setup.sh @@ -13,6 +13,7 @@ echo "worker_processes ${NGINX_WORKER_PROCESSES};" > /etc/nginx/workers.conf sed -i "s/^user .*/user ${WEBUSER};/" /etc/nginx/nginx.conf sed -i "s/CACHE_INDEX_SIZE/${CACHE_INDEX_SIZE}/" /etc/nginx/conf.d/20_proxy_cache_path.conf sed -i "s/CACHE_DISK_SIZE/${CACHE_DISK_SIZE}/" /etc/nginx/conf.d/20_proxy_cache_path.conf +sed -i "s/CACHE_MAX_AGE/${CACHE_MAX_AGE}/" /etc/nginx/conf.d/20_proxy_cache_path.conf sed -i "s/CACHE_MAX_AGE/${CACHE_MAX_AGE}/" /etc/nginx/sites-available/cache.conf.d/root/20_cache.conf sed -i "s/slice 1m;/slice ${CACHE_SLICE_SIZE};/" /etc/nginx/sites-available/cache.conf.d/root/20_cache.conf sed -i "s/UPSTREAM_DNS/${UPSTREAM_DNS}/" /etc/nginx/sites-available/cache.conf.d/10_root.conf