Skip to content

Commit

Permalink
[IMP] Added Nginx cache cusomisation capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
Hadrien Huvelle committed Jun 29, 2023
1 parent 6d69253 commit e5a1c34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions 9.0/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
4 changes: 3 additions & 1 deletion 9.0/templates/nginx.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)$ {
Expand Down

0 comments on commit e5a1c34

Please sign in to comment.