Created
May 25, 2021 13:33
-
-
Save mutatrum/f2251b1c33896e2b64549d72a88a9918 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| map $http_accept_language $header_lang { | |
| default en-US; | |
| ~*^en-US en-US; | |
| ~*^en en-US; | |
| ~*^ar ar; | |
| ~*^cs cs; | |
| ~*^de de; | |
| ~*^es es; | |
| ~*^fa fa; | |
| ~*^fr fr; | |
| ~*^ko ko; | |
| ~*^it it; | |
| ~*^ka ka; | |
| ~*^hu hu; | |
| ~*^nl nl; | |
| ~*^ja ja; | |
| ~*^nb nb; | |
| ~*^pt pt; | |
| ~*^sl sl; | |
| ~*^fi fi; | |
| ~*^sv sv; | |
| ~*^tr tr; | |
| ~*^uk uk; | |
| ~*^vi vi; | |
| ~*^zh zh; | |
| } | |
| map $cookie_lang $lang { | |
| default $header_lang; | |
| ~*^en-US en-US; | |
| ~*^en en-US; | |
| ~*^ar ar; | |
| ~*^cs cs; | |
| ~*^de de; | |
| ~*^es es; | |
| ~*^fa fa; | |
| ~*^fr fr; | |
| ~*^ko ko; | |
| ~*^it it; | |
| ~*^ka ka; | |
| ~*^hu hu; | |
| ~*^nl nl; | |
| ~*^ja ja; | |
| ~*^nb nb; | |
| ~*^pt pt; | |
| ~*^sl sl; | |
| ~*^fi fi; | |
| ~*^sv sv; | |
| ~*^tr tr; | |
| ~*^uk uk; | |
| ~*^vi vi; | |
| ~*^zh zh; | |
| } | |
| server { | |
| listen *:4000; | |
| access_log /var/log/nginx/access_mempool.log; | |
| error_log /var/log/nginx/error_mempool.log; | |
| root /home/bitcoin/mempool/frontend/dist/mempool/browser; | |
| index index.html; | |
| # fallback for all URLs i.e. /address/foo /tx/foo /block/000 | |
| location / { | |
| try_files /$lang/$uri /$lang/$uri/ $uri $uri/ /en-US/$uri @index-redirect; | |
| } | |
| location @index-redirect { | |
| add_header vary accept-language; | |
| rewrite (.*) /$lang/index.html; | |
| } | |
| # location block using regex are matched in order | |
| # used to rewrite resources from /<lang>/ to /en-US/ | |
| location ~ ^/(ar|bg|bs|ca|cs|da|de|et|el|es|eo|eu|fa|fr|gl|ko|hr|id|it|he|ka|lv|lt|hu|mk|ms|nl|ja|ka|no|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh)/resources/ { | |
| rewrite ^/[a-zA-Z-]*/resources/(.*) /en-US/resources/$1; | |
| } | |
| # used for cookie override | |
| location ~ ^/(ar|bg|bs|ca|cs|da|de|et|el|es|eo|eu|fa|fr|gl|ko|hr|id|it|he|ka|lv|lt|hu|mk|ms|nl|ja|ka|no|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh)/ { | |
| try_files $uri $uri/ /$1/index.html =404; | |
| } | |
| # static API docs | |
| location = /api { | |
| try_files $uri $uri/ /en-US/index.html =404; | |
| } | |
| location = /api/ { | |
| try_files $uri $uri/ /en-US/index.html =404; | |
| } | |
| # mainnet API | |
| location /api/v1/donations { | |
| proxy_pass https://mempool.space; | |
| } | |
| location /api/v1/donations/images { | |
| proxy_pass https://mempool.space; | |
| } | |
| location /api/v1/ws { | |
| proxy_pass http://127.0.0.1:8999/; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "Upgrade"; | |
| } | |
| location /api/v1 { | |
| proxy_pass http://127.0.0.1:8999/api/v1; | |
| } | |
| location /api/ { | |
| proxy_pass http://127.0.0.1:8999/api/v1/; | |
| } | |
| # mainnet API | |
| location /ws { | |
| proxy_pass http://127.0.0.1:8999/; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "Upgrade"; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment