From b89a549a754124d7aa61908077d018064fd20094 Mon Sep 17 00:00:00 2001 From: wiz Date: Fri, 6 Nov 2020 14:09:04 +0900 Subject: [PATCH] Enable nginx reverse proxy cache for sponsor profile images + misc tweaks --- production/nginx.conf | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/production/nginx.conf b/production/nginx.conf index 605c3ba16..b4ec96d28 100644 --- a/production/nginx.conf +++ b/production/nginx.conf @@ -54,6 +54,9 @@ http { # limit request body size client_max_body_size 10m; + # proxy cache + proxy_cache_path /var/cache/nginx keys_zone=cache:20m levels=1:2 inactive=600s max_size=500m; + # rate limit requests limit_req_zone $binary_remote_addr zone=api:5m rate=50r/m; limit_req_zone $binary_remote_addr zone=electrs:5m rate=1000r/m; @@ -104,6 +107,7 @@ http { add_header Content-Security-Policy $contentSecurityPolicy; add_header Link "; rel=\"canonical\""; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; + #add_header Onion-Location http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion$request_uri; # / @@ -111,6 +115,16 @@ http { try_files $uri $uri/ /index.html =404; } +# # /sitemap +# location /sitemap { +# try_files $uri =410; +# } +# +# # /explorer +# location /explorer { +# rewrite /explorer/(.*) https://$host/$1 permanent; +# } + # /api location = /api { @@ -120,8 +134,10 @@ http { try_files $uri $uri/ /index.html =404; } location /api/v1/donations { - proxy_pass http://127.0.0.1:8999; # don't rate limit this URL prefix + proxy_pass http://127.0.0.1:8999; + proxy_cache cache; + proxy_cache_valid 200 1d; } location /api/v1/ws { proxy_pass http://127.0.0.1:8999/; @@ -224,7 +240,6 @@ http { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; - limit_conn websocket 10; } location /bisq/api/v1/markets { proxy_pass http://127.0.0.1:8996/api/v1/bisq/markets; @@ -236,7 +251,7 @@ http { } location /bisq/api { proxy_pass http://127.0.0.1:8996/api/v1/bisq; - limit_req burst=100 nodelay zone=electrs; + limit_req burst=50 nodelay zone=api; } } }