Skip to content

A platform for community discussion. Free, open, simple.

PERF: cache static assets in NGINX for longer

Sam Saffron1d1dd2a4d436
diff --git a/config/nginx.sample.conf b/config/nginx.sample.conf
index 5e67988416a..538e29fab4a 100644
--- a/config/nginx.sample.conf
+++ b/config/nginx.sample.conf
@@ -10,7 +10,10 @@ upstream discourse {
server unix:/var/www/discourse/tmp/sockets/thin.3.sock;
}
-proxy_cache_path /var/nginx/cache keys_zone=one:10m max_size=200m;
+# inactive means we keep stuff around for 1440m minutes regardless of last access (1 week)
+# levels means it is a 2 deep heirarchy cause we can have lots of files
+# max_size limits the size of the cache
+proxy_cache_path /var/nginx/cache inactive=1440m levels=1:2 keys_zone=one:10m max_size=600m;
# see: https://meta.discourse.org/t/x/74060
proxy_buffer_size 8k;