From 22ef7a7ae8962a1643c90c7d4ffe4a3e8150f4c6 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Thu, 26 Oct 2023 06:18:57 -0500 Subject: [PATCH] implement nginx caching --- docker/main/rootfs/usr/local/nginx/conf/nginx.conf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf index 6d0861406..07907e46a 100644 --- a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf +++ b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf @@ -32,6 +32,8 @@ http { gzip_proxied no-cache no-store private expired auth; gzip_vary on; + proxy_cache_path /dev/shm/nginx_cache levels=1:2 keys_zone=api_cache:10m max_size=10m inactive=1m use_temp_path=off; + upstream frigate_api { server 127.0.0.1:5001; keepalive 1024; @@ -185,6 +187,11 @@ http { proxy_pass http://frigate_api/; include proxy.conf; + proxy_cache api_cache; + proxy_cache_lock on; + proxy_cache_use_stale updating; + proxy_cache_valid any 10s; + location /api/stats { access_log off; rewrite ^/api/(.*)$ $1 break;