From 16070d8b6feb52266adb5bb714295ffcf3a44c0c Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 19 Oct 2020 04:12:17 +0200 Subject: [PATCH] Tweak and document nginx caching in example. --- README.adoc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.adoc b/README.adoc index 6889582..4e0a052 100644 --- a/README.adoc +++ b/README.adoc @@ -27,14 +27,17 @@ tools to generate a HTML list and an RSS generator. .nginx config [source,nginx] -------------------------------------------------------------------------------- -fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=fediblock:10m; +# Use 100 MiB cache with a 1 MiB memory zone (enough for ~8,000 keys). +# Delete data that has not been accessed for 10 minutes. +fastcgi_cache_path /var/cache/nginx/fediblock levels=1:2 max_size=100m + keys_zone=fediblock:1m inactive=10m use_temp_path=off; fastcgi_cache_key "$scheme$request_method$host$request_uri"; add_header X-Cache $upstream_cache_status; server { # […] - expires 1h; + expires 30m; location /add { include /etc/nginx/fastcgi_params; @@ -49,7 +52,8 @@ server { fastcgi_param SCRIPT_FILENAME /usr/bin/fediblock-backend-gen_rss; fastcgi_param HOME "/var/lib/nginx"; fastcgi_cache fediblock; - fastcgi_cache_valid 200 10m; + fastcgi_cache_valid 200 15m; # Cache answers for up to 15 minutes. + fastcgi_cache_lock on; # Relay only one identical request at a time. } } --------------------------------------------------------------------------------