2020-08-19 13:26:03 +09:00
user nobody ;
pid /var/run/nginx.pid ;
2020-02-24 03:11:07 +07:00
include /etc/nginx/modules-enabled/*.conf ;
2020-08-19 13:26:03 +09:00
worker_processes auto ;
worker_rlimit_nofile 9999 ;
2020-02-24 03:11:07 +07:00
events {
2020-08-19 13:26:03 +09:00
worker_connections 9000 ;
multi_accept on ;
2020-02-24 03:11:07 +07:00
}
http {
sendfile on ;
tcp_nopush on ;
tcp_nodelay on ;
keepalive_timeout 300s ;
types_hash_max_size 2048 ;
include /etc/nginx/mime.types ;
default_type application/octet-stream ;
2020-08-19 13:26:03 +09:00
ssl_protocols TLSv1.2 TlSv1.3 ;
2020-02-24 03:11:07 +07:00
ssl_prefer_server_ciphers on ;
access_log /var/log/nginx/access.log ;
error_log /var/log/nginx/error.log ;
2020-02-26 23:07:48 +09:00
proxy_cache off ;
2020-02-24 03:11:07 +07:00
gzip on ;
gzip_comp_level 5 ;
gzip_min_length 256 ;
gzip_proxied any ;
gzip_vary on ;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd .geo+json application/vnd .ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd .rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy ; # text/html is always compressed by gzip module
server {
listen 80 ;
listen [::]:80 ;
2020-08-19 13:26:03 +09:00
server_name __HOSTNAME_FQDN__ ;
2020-02-24 03:11:07 +07:00
2020-08-19 13:26:03 +09:00
if ( $host = __HOSTNAME_FQDN__) {
2020-02-24 03:11:07 +07:00
return 301 https:// $host$request_uri ;
2020-08-19 13:26:03 +09:00
}
2020-02-24 03:11:07 +07:00
2020-08-19 13:26:03 +09:00
return 404 ;
2020-02-24 03:11:07 +07:00
}
server {
2020-08-19 13:26:03 +09:00
listen 127.0.0.1 : 81 ;
listen [::]:443 ssl default http2 ;
listen 443 ssl default http2 ;
ssl_certificate /etc/letsencrypt/live/__HOSTNAME_FQDN__/fullchain.pem ;
ssl_certificate_key /etc/letsencrypt/live/__HOSTNAME_FQDN__/privkey.pem ;
include /etc/letsencrypt/options-ssl-nginx.conf ;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem ;
root /mempool/public_html/mainnet/ ;
index index.html index.htm index.nginx-debian.html ;
server_name __HOSTNAME_FQDN__ ;
set $frameOptions "DENY" ;
set $contentSecurityPolicy "frame-ancestors 'none'" ;
if ( $http_referer ~ ^https://__HOSTNAME_FQDN__/)
{
set $frameOptions "ALLOW-FROM https://__HOSTNAME_FQDN__" ;
set $contentSecurityPolicy "frame-ancestors https://__HOSTNAME_FQDN__" ;
}
2020-02-24 03:11:07 +07:00
2020-08-19 13:26:03 +09:00
add_header X-Frame-Options $frameOptions ;
add_header Content-Security-Policy $contentSecurityPolicy ;
add_header Link "<https://__HOSTNAME_FQDN__ $request_uri> ; rel=\"canonical\"" ;
add_header Onion-Location http://__HOSTNAME_ONION__ $request_uri ;
add_header Strict-Transport-Security "max-age=63072000 ; includeSubDomains ; preload" ;
2020-02-24 03:11:07 +07:00
location / {
try_files $uri $uri/ /index.html = 404 ;
}
2020-08-19 13:26:03 +09:00
location /explorer {
rewrite /explorer/(.*) https:// $host/$1 permanent ;
}
location /webhook {
proxy_pass http://127.0.0.1:2222/ ;
}
location /api/v1/ws {
proxy_pass http://__MEMPOOL_MAINNET_HTTP_HOST__:__MEMPOOL_MAINNET_HTTP_PORT__/ ;
proxy_http_version 1 .1 ;
proxy_set_header Upgrade $http_upgrade ;
proxy_set_header Connection "Upgrade" ;
}
location /api/v1 {
proxy_pass http://__MEMPOOL_MAINNET_HTTP_HOST__:__MEMPOOL_MAINNET_HTTP_PORT__/api/v1 ;
}
location /api/ {
proxy_pass http://__ELECTRS_MAINNET_HTTP_HOST__:__ELECTRS_MAINNET_HTTP_PORT__/ ;
}
location /mainnet/api/v1/ws {
proxy_pass http://__MEMPOOL_MAINNET_HTTP_HOST__:__MEMPOOL_MAINNET_HTTP_PORT__/ ;
proxy_http_version 1 .1 ;
proxy_set_header Upgrade $http_upgrade ;
proxy_set_header Connection "Upgrade" ;
}
location /mainnet/api/v1 {
proxy_pass http://__MEMPOOL_MAINNET_HTTP_HOST__:__MEMPOOL_MAINNET_HTTP_PORT__/api/v1 ;
}
location /mainnet/api/ {
proxy_pass http://__ELECTRS_MAINNET_HTTP_HOST__:__ELECTRS_MAINNET_HTTP_PORT__/ ;
}
location /liquid/api/v1/ws {
proxy_pass http://__MEMPOOL_LIQUID_HTTP_HOST__:__MEMPOOL_LIQUID_HTTP_PORT__/ ;
proxy_http_version 1 .1 ;
proxy_set_header Upgrade $http_upgrade ;
proxy_set_header Connection "Upgrade" ;
}
location /liquid/api/v1 {
proxy_pass http://__MEMPOOL_LIQUID_HTTP_HOST__:__MEMPOOL_LIQUID_HTTP_PORT__/api/v1 ;
}
location /liquid/api/ {
proxy_pass http://__ELECTRS_LIQUID_HTTP_HOST__:__ELECTRS_LIQUID_HTTP_PORT__/ ;
2020-02-24 03:11:07 +07:00
}
2020-08-19 13:26:03 +09:00
location /testnet/api/v1/ws {
proxy_pass http://__MEMPOOL_TESTNET_HTTP_HOST__:__MEMPOOL_TESTNET_HTTP_PORT__/ ;
proxy_http_version 1 .1 ;
proxy_set_header Upgrade $http_upgrade ;
proxy_set_header Connection "Upgrade" ;
}
location /testnet/api/v1 {
proxy_pass http://__MEMPOOL_TESTNET_HTTP_HOST__:__MEMPOOL_TESTNET_HTTP_PORT__/api/v1 ;
}
location /testnet/api/ {
proxy_pass http://__ELECTRS_TESTNET_HTTP_HOST__:__ELECTRS_TESTNET_HTTP_PORT__/ ;
2020-02-25 01:09:49 +09:00
}
2020-08-19 13:26:03 +09:00
location /bisq/api/v1/ws {
proxy_pass http://__MEMPOOL_BISQ_HTTP_HOST__:__MEMPOOL_BISQ_HTTP_PORT__/ ;
2020-02-24 03:11:07 +07:00
proxy_http_version 1 .1 ;
proxy_set_header Upgrade $http_upgrade ;
proxy_set_header Connection "Upgrade" ;
}
2020-08-19 13:26:03 +09:00
location /bisq/api/v1 {
proxy_pass http://__MEMPOOL_BISQ_HTTP_HOST__:__MEMPOOL_BISQ_HTTP_PORT__/api/v1 ;
}
location /bisq/api {
proxy_pass http://__MEMPOOL_BISQ_HTTP_HOST__:__MEMPOOL_BISQ_HTTP_PORT__/api/v1/bisq ;
}
2020-02-24 03:11:07 +07:00
}
}