Add caching to nginx example.
This commit is contained in:
parent
8574da33a7
commit
15ee493084
|
@ -1,25 +1,34 @@
|
||||||
# RSS feeds will be available at <https://rss.example.com/?repo=user/project>.
|
# 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/gitea2rss levels=1:2 keys_zone=gitea2rss:1m
|
||||||
|
max_size=100m inactive=10m use_temp_path=off;
|
||||||
|
fastcgi_cache_key "$scheme$request_method$host$request_uri";
|
||||||
|
add_header X-Cache $upstream_cache_status;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
listen [::]:443 ssl;
|
listen [::]:443 ssl;
|
||||||
server_name rss.example.com;
|
server_name rss.example.com;
|
||||||
|
|
||||||
#access_log /var/log/nginx/rss.access_log main;
|
error_log /var/log/nginx/rss.example.com_log warn;
|
||||||
error_log /var/log/nginx/rss.error_log warn;
|
|
||||||
|
|
||||||
ssl_certificate /var/lib/dehydrated/certs/rss.example.com/fullchain.pem;
|
ssl_certificate /var/lib/dehydrated/certs/rss.example.com/fullchain.pem;
|
||||||
ssl_certificate_key /var/lib/dehydrated/certs/rss.example.com/privkey.pem;
|
ssl_certificate_key /var/lib/dehydrated/certs/rss.example.com/privkey.pem;
|
||||||
|
|
||||||
# Tell clients to cache for 1 hour.
|
# Tell clients to cache for 30 minutes.
|
||||||
expires 1h;
|
expires 30m;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
include /etc/nginx/fastcgi_params;
|
include /etc/nginx/fastcgi_params;
|
||||||
# You may need to change fastcgi_pass.
|
# You may need to change fastcgi_pass.
|
||||||
fastcgi_pass unix:/var/run/cgi-fcgiwrap.socket-1;
|
fastcgi_pass unix:/var/run/cgi-fcgiwrap.socket-1;
|
||||||
fastcgi_param SCRIPT_FILENAME /usr/bin/gitea2rss;
|
fastcgi_param SCRIPT_FILENAME /usr/bin/gitea2rss;
|
||||||
|
|
||||||
# Base URL of your Gitea instance.
|
# Base URL of your Gitea instance.
|
||||||
fastcgi_param GITEA2RSS_BASEURL "https://git.example.com";
|
fastcgi_param GITEA2RSS_BASEURL "https://git.example.com";
|
||||||
|
|
||||||
|
fastcgi_cache gitea2rss;
|
||||||
|
fastcgi_cache_valid 200 20m; # Cache answers for up to 20 minutes.
|
||||||
|
fastcgi_cache_lock on; # Relay only one identical request at a time.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user