diff --git a/production/nginx-mempool-ssr.conf b/production/nginx-mempool-ssr.conf index 3b1be281c..5c80bb75f 100644 --- a/production/nginx-mempool-ssr.conf +++ b/production/nginx-mempool-ssr.conf @@ -115,7 +115,7 @@ } location /api/v1/donations/images { proxy_pass http://127.0.0.1:8999; - proxy_cache cache; + proxy_cache services; proxy_cache_valid 200 1d; } location /api/v1/ws { diff --git a/production/nginx-mempool.conf b/production/nginx-mempool.conf index bff7be8a4..e0489ad0b 100644 --- a/production/nginx-mempool.conf +++ b/production/nginx-mempool.conf @@ -109,7 +109,7 @@ } location /api/v1/donations/images { proxy_pass https://node220.bitcoin.wiz.biz; - proxy_cache cache; + proxy_cache services; proxy_cache_valid 200 1d; } location /api/v1/ws { diff --git a/production/nginx.conf b/production/nginx.conf index 3b24c646b..83a605f02 100644 --- a/production/nginx.conf +++ b/production/nginx.conf @@ -51,12 +51,13 @@ http { # proxy cache proxy_cache off; - proxy_cache_path /var/cache/nginx keys_zone=cache:20m levels=1:2 inactive=600s max_size=500m; + proxy_cache_path /var/cache/nginx/services keys_zone=services:20m levels=1:2 inactive=600s max_size=100m; + proxy_cache_path /var/cache/nginx/mainnet keys_zone=mainnet:20m levels=1:2 inactive=600s max_size=100m; + proxy_cache_path /var/cache/nginx/testnet keys_zone=testnet:20m levels=1:2 inactive=600s max_size=100m; + proxy_cache_path /var/cache/nginx/liquid keys_zone=liquid:20m levels=1:2 inactive=600s max_size=100m; + proxy_cache_path /var/cache/nginx/signet keys_zone=signet:20m levels=1:2 inactive=600s max_size=100m; types_hash_max_size 2048; - # set proxy to use http/1.1 - proxy_http_version 1.1; - # exempt localhost from rate limit geo $limited_ip { default 1; @@ -72,11 +73,11 @@ http { } # rate limit requests - limit_req_zone $limited_ip_key zone=api:5m rate=200r/m; - limit_req_zone $limited_ip_key zone=electrs-address:5m rate=100r/m; - limit_req_zone $limited_ip_key zone=electrs-block:5m rate=200r/m; - limit_req_zone $limited_ip_key zone=electrs-tx:5m rate=300r/m; - limit_req_zone $limited_ip_key zone=electrs:5m rate=2000r/m; + limit_req_zone $limited_ip_key zone=api:10m rate=200r/m; + limit_req_zone $limited_ip_key zone=electrs-address:10m rate=100r/m; + limit_req_zone $limited_ip_key zone=electrs-block:10m rate=200r/m; + limit_req_zone $limited_ip_key zone=electrs-tx:10m rate=2000r/m; + limit_req_zone $limited_ip_key zone=electrs:10m rate=2000r/m; limit_req_status 429; # rate limit connections @@ -138,7 +139,8 @@ http { } upstream electrs-mainnet { - server [::1]:3000 fail_timeout=10s max_fails=10; + server [2401:b140:1::92:201]:3000 weight=999 fail_timeout=10s max_fails=10; + server [2401:b140:1::92:202]:3000 weight=1 fail_timeout=10s max_fails=10; server [2401:b140:1::100:220]:3000 backup; server [2401:b140:1::100:210]:3000 backup; } @@ -147,11 +149,14 @@ http { access_log /dev/null; location / { proxy_pass http://electrs-mainnet; + proxy_cache mainnet; + proxy_cache_valid 200 2s; } } upstream electrs-liquid { - server [::1]:3001 fail_timeout=10s max_fails=10; + server [2401:b140:1::92:201]:3001 weight=999 fail_timeout=10s max_fails=10; + server [2401:b140:1::92:202]:3001 weight=1 fail_timeout=10s max_fails=10; server [2401:b140:1::100:220]:3001 backup; server [2401:b140:1::100:210]:3001 backup; } @@ -160,11 +165,14 @@ http { access_log /dev/null; location / { proxy_pass http://electrs-liquid; + proxy_cache liquid; + proxy_cache_valid 200 2s; } } upstream electrs-testnet { - server [::1]:3002 fail_timeout=10s max_fails=10; + server [2401:b140:1::92:201]:3002 weight=999 fail_timeout=10s max_fails=10; + server [2401:b140:1::92:202]:3002 weight=1 fail_timeout=10s max_fails=10; server [2401:b140:1::100:220]:3002 backup; server [2401:b140:1::100:210]:3002 backup; } @@ -173,19 +181,23 @@ http { access_log /dev/null; location / { proxy_pass http://electrs-testnet; + proxy_cache testnet; + proxy_cache_valid 200 2s; } } upstream electrs-signet { - server [::1]:3003 fail_timeout=10s max_fails=10; + server [2401:b140:1::92:201]:3003 weight=999 fail_timeout=10s max_fails=10; + server [2401:b140:1::92:202]:3003 weight=1 fail_timeout=10s max_fails=10; server [2401:b140:1::100:220]:3003 backup; - server [2401:b140:1::100:210]:3003 backup; } server { listen 127.0.0.1:4003; access_log /dev/null; location / { proxy_pass http://electrs-signet; + proxy_cache signet; + proxy_cache_valid 200 2s; } }