From b23a68792398a2ef47d9437abce6133f239144ba Mon Sep 17 00:00:00 2001 From: Tine Date: Tue, 6 Feb 2024 13:33:34 +0100 Subject: [PATCH] feat(analytics): caching --- Dockerfile | 2 ++ nginx.conf | 1 + 2 files changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 5ecd55d..8947cc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,3 +18,5 @@ COPY --chown=nobody:nogroup nginx.conf /etc/nginx/conf.d/default.conf # Copy what we've installed/built from production COPY --chown=nobody:nogroup --from=build /home/node/app/build /usr/share/nginx/html/ +# Caching directory +RUN mkdir -p /var/run/nginx-cache diff --git a/nginx.conf b/nginx.conf index 218445f..341fd02 100644 --- a/nginx.conf +++ b/nginx.conf @@ -18,6 +18,7 @@ server { # https://plausible.io/docs/proxy/guides/nginx set $plausible_script_url https://plausible.io/js/script.js; # Change this if you use a different variant of the script set $plausible_event_url https://plausible.io/api/event; + proxy_cache_path /var/run/nginx-cache/jscache levels=1:2 keys_zone=jscache:100m inactive=30d use_temp_path=off max_size=100m; location = /js/script.js { proxy_pass $plausible_script_url; proxy_set_header Host plausible.io;