| 
									
										
										
										
											2021-01-11 23:07:16 +09:00
										 |  |  | 	access_log /var/log/nginx/access_mempool.log; | 
					
						
							|  |  |  | 	error_log /var/log/nginx/error_mempool.log; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	root /var/www/mempool/browser; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	index index.html; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-19 18:36:13 +09:00
										 |  |  | 	# enable browser and proxy caching | 
					
						
							|  |  |  | 	add_header Cache-Control "public, no-transform"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	# vary cache if user changes language preference | 
					
						
							|  |  |  | 	add_header Vary Accept-Language; | 
					
						
							|  |  |  | 	add_header Vary Cookie; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-11 23:07:16 +09:00
										 |  |  | 	# 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; | 
					
						
							| 
									
										
										
										
											2021-07-19 18:36:13 +09:00
										 |  |  | 		expires 10m; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	location /resources { | 
					
						
							|  |  |  | 		try_files /$lang/$uri /$lang/$uri/ $uri $uri/ /en-US/$uri @index-redirect; | 
					
						
							|  |  |  | 		expires 1h; | 
					
						
							| 
									
										
										
										
											2021-01-11 23:07:16 +09:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	location @index-redirect { | 
					
						
							|  |  |  | 		rewrite (.*) /$lang/index.html; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	# location block using regex are matched in order | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	# used to rewrite resources from /<lang>/ to /en-US/ | 
					
						
							| 
									
										
										
										
											2021-07-19 18:36:13 +09:00
										 |  |  | 	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|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh|hi)/resources/ { | 
					
						
							| 
									
										
										
										
											2021-01-11 23:07:16 +09:00
										 |  |  | 		rewrite ^/[a-zA-Z-]*/resources/(.*) /en-US/resources/$1; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	# used for cookie override | 
					
						
							| 
									
										
										
										
											2021-07-19 18:36:13 +09:00
										 |  |  | 	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|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh|hi)/ { | 
					
						
							| 
									
										
										
										
											2021-01-11 23:07:16 +09:00
										 |  |  | 		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; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2021-03-09 03:56:41 +09:00
										 |  |  | 	location /api/v1/contributors { | 
					
						
							|  |  |  | 		proxy_pass https://mempool.space; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	location /api/v1/contributors/images { | 
					
						
							|  |  |  | 		proxy_pass https://mempool.space; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2021-01-11 23:07:16 +09:00
										 |  |  | 	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"; | 
					
						
							|  |  |  | 	} |