181 lines
5.8 KiB
Plaintext
181 lines
5.8 KiB
Plaintext
server {
|
|
listen 80 default_server;
|
|
server_name _;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
map $scheme $ws_scheme {
|
|
default "ws";
|
|
https "wss";
|
|
}
|
|
|
|
# ===== api.qortal.org =====
|
|
server {
|
|
listen 443 ssl;
|
|
server_name api.qortal.org;
|
|
|
|
ssl_certificate /home/crowetic/certs/cloudflarecertqortal.org.pem;
|
|
ssl_certificate_key /home/crowetic/certs/cloudflarecertqortal.org.key;
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
client_max_body_size 500M;
|
|
|
|
# Block POST/DELETE to sensitive endpoints
|
|
location ~* ^/(lists|admin/(restart|stop|forcesync|apikey/generate|enginestats|orphan|mintingaccounts)|arbitrary/resources/cache/rebuild)$ {
|
|
if ($request_method ~* ^(POST|DELETE)$) {
|
|
access_log /var/log/nginx/forbidden-methods.log;
|
|
return 403;
|
|
}
|
|
}
|
|
|
|
# Fully deny dangerous paths
|
|
location ~* ^/(admin/repository/|admin/logs|admin/bootstrap|arbitrary/hosted|crosschain/tradebot|bootstrap/create)$ {
|
|
deny all;
|
|
error_log /var/log/nginx/forbidden.log debug;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:12391;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
send_timeout 3600s;
|
|
keepalive_timeout 3600s;
|
|
proxy_request_buffering off;
|
|
proxy_buffering off;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
}
|
|
|
|
location /websockets/ {
|
|
proxy_pass http://127.0.0.1:12391/websockets/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "Upgrade";
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
location /websockets/crosschain/ {
|
|
proxy_pass $ws_scheme://127.0.0.1:12391/websockets/crosschain/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "Upgrade";
|
|
proxy_set_header Host $host;
|
|
}
|
|
}
|
|
|
|
# ===== api1.qortal.org =====
|
|
server {
|
|
listen 443 ssl;
|
|
server_name api1.qortal.org;
|
|
|
|
ssl_certificate /home/crowetic/certs/cloudflarecert2.api.qortal.org.pem;
|
|
ssl_certificate_key /home/crowetic/certs/cloudflarecert2.api.qortal.org.key;
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
client_max_body_size 500M;
|
|
|
|
location ~* ^/(lists|admin/(restart|stop|forcesync|apikey/generate|enginestats|orphan|mintingaccounts)|arbitrary/resources/cache/rebuild)$ {
|
|
if ($request_method ~* ^(POST|DELETE)$) {
|
|
access_log /var/log/nginx/forbidden-methods.log;
|
|
return 403;
|
|
}
|
|
}
|
|
|
|
location ~* ^/(admin/repository/|admin/logs|admin/bootstrap|arbitrary/hosted|crosschain/tradebot|bootstrap/create)$ {
|
|
deny all;
|
|
error_log /var/log/nginx/forbidden.log debug;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:12391;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
send_timeout 3600s;
|
|
keepalive_timeout 3600s;
|
|
proxy_request_buffering off;
|
|
proxy_buffering off;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
}
|
|
|
|
location /websockets/ {
|
|
proxy_pass http://127.0.0.1:12391/websockets/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "Upgrade";
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
location /websockets/crosschain/ {
|
|
proxy_pass $ws_scheme://127.0.0.1:12391/websockets/crosschain/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "Upgrade";
|
|
proxy_set_header Host $host;
|
|
}
|
|
}
|
|
|
|
# ===== pubnode.qortal.org =====
|
|
server {
|
|
listen 443 ssl;
|
|
server_name pubnode.qortal.org;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/pubnode.qortal.org/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/pubnode.qortal.org/privkey.pem;
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
client_max_body_size 500M;
|
|
|
|
location ~* ^/(lists|admin/(restart|stop|forcesync|apikey/generate|enginestats|orphan|mintingaccounts)|arbitrary/resources/cache/rebuild)$ {
|
|
if ($request_method ~* ^(POST|DELETE)$) {
|
|
access_log /var/log/nginx/forbidden-methods.log;
|
|
return 403;
|
|
}
|
|
}
|
|
|
|
location ~* ^/(admin/repository/|admin/logs|admin/bootstrap|arbitrary/hosted|crosschain/tradebot|bootstrap/create)$ {
|
|
deny all;
|
|
error_log /var/log/nginx/forbidden.log debug;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:12391;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
send_timeout 3600s;
|
|
keepalive_timeout 3600s;
|
|
proxy_request_buffering off;
|
|
proxy_buffering off;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
}
|
|
|
|
location /websockets/ {
|
|
proxy_pass http://127.0.0.1:12391/websockets/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "Upgrade";
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
location /websockets/crosschain/ {
|
|
proxy_pass $ws_scheme://127.0.0.1:12391/websockets/crosschain/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "Upgrade";
|
|
proxy_set_header Host $host;
|
|
}
|
|
}
|