Tweak and document nginx caching in example.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2020-10-19 04:12:17 +02:00
parent 3b9424b6af
commit 16070d8b6f
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 7 additions and 3 deletions

View File

@ -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.
}
}
--------------------------------------------------------------------------------