Update nginx config example.
* Add rate limiting. * Add API endpoint.
This commit is contained in:
parent
c9002f3640
commit
c7943d88d0
15
README.adoc
15
README.adoc
|
@ -36,6 +36,8 @@ fastcgi_cache_path /var/cache/nginx/fediblock levels=1:2 max_size=100m
|
|||
fastcgi_cache_key "$scheme$request_method$host$request_uri";
|
||||
add_header X-Cache $upstream_cache_status;
|
||||
|
||||
limit_req_zone $binary_remote_addr zone=fediblock_add:10m rate=1r/m;
|
||||
|
||||
server {
|
||||
# […]
|
||||
|
||||
|
@ -50,6 +52,9 @@ server {
|
|||
fastcgi_pass unix:/var/run/cgi-fcgiwrap.socket-1;
|
||||
fastcgi_param SCRIPT_FILENAME /usr/bin/fediblock-backend;
|
||||
fastcgi_param HOME "/var/lib/nginx"; # When I didn't set it, HOME was /root.
|
||||
|
||||
client_max_body_size 5M;
|
||||
limit_req zone=fediblock_add;
|
||||
}
|
||||
|
||||
location /rss {
|
||||
|
@ -61,6 +66,16 @@ server {
|
|||
fastcgi_cache_valid 200 15m; # Cache answers for up to 15 minutes.
|
||||
fastcgi_cache_lock on; # Relay only one identical request at a time.
|
||||
}
|
||||
|
||||
location /api/v1/list {
|
||||
include /etc/nginx/fastcgi_params;
|
||||
fastcgi_pass unix:/var/run/cgi-fcgiwrap.socket-1;
|
||||
fastcgi_param SCRIPT_FILENAME /usr/bin/fediblock-backend-json_api;
|
||||
fastcgi_param HOME "/var/lib/nginx";
|
||||
fastcgi_cache fediblock;
|
||||
fastcgi_cache_valid 200 15m; # Cache answers for up to 15 minutes.
|
||||
fastcgi_cache_lock on; # Relay only one identical request at a time.
|
||||
}
|
||||
}
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
|
Reference in New Issue