resolve merge: keep nginx_hivemind_reality.conf with swarm auth + rate limit
This commit is contained in:
commit
3afebd66fb
1 file changed
-73
@@ -1,73 +0,0 @@
|
|||||||
# nginx config for ReVoltVPN — Reality era
|
|
||||||
# Path: /etc/nginx/sites-available/hivemind
|
|
||||||
#
|
|
||||||
# After Reality migration:
|
|
||||||
# - /tunnel and /tunnel-throttled locations are REMOVED
|
|
||||||
# - Xray Reality handles the VPN tunnel directly on port 8443
|
|
||||||
# - nginx only serves the API (proxied to Flask) and any static website
|
|
||||||
|
|
||||||
# ── Rate limiting (uncomment when you need it) ───────────────────────────
|
|
||||||
# Defines a 10MB shared memory zone tracking request rate per IP.
|
|
||||||
# 10 r/s with burst of 20 — anything above gets HTTP 503.
|
|
||||||
# limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/s;
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 443 ssl http2;
|
|
||||||
server_name getrevolt.app; # ◄── CHANGE ME to your domain
|
|
||||||
|
|
||||||
# ── SSL (Let's Encrypt) ──────────────────────────────────────────────
|
|
||||||
ssl_certificate /etc/letsencrypt/live/getrevolt.app/fullchain.pem;
|
|
||||||
ssl_certificate_key /etc/letsencrypt/live/getrevolt.app/privkey.pem;
|
|
||||||
|
|
||||||
# ── Swarm monitor endpoints (lock behind basic auth) ────────────────
|
|
||||||
# Generate password file on server:
|
|
||||||
# apt install apache2-utils
|
|
||||||
# htpasswd -c /etc/nginx/.htpasswd admin
|
|
||||||
location /api/swarm {
|
|
||||||
auth_basic "Hivemind Monitor";
|
|
||||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
|
||||||
proxy_pass http://127.0.0.1:5000;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
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_read_timeout 30s;
|
|
||||||
}
|
|
||||||
location /api/log {
|
|
||||||
auth_basic "Hivemind Monitor";
|
|
||||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
|
||||||
proxy_pass http://127.0.0.1:5000;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
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_read_timeout 30s;
|
|
||||||
}
|
|
||||||
|
|
||||||
# ── API proxy to Hivemind (Flask) ────────────────────────────────────
|
|
||||||
location /api/ {
|
|
||||||
# Rate limiting — uncomment when you uncomment limit_req_zone above.
|
|
||||||
# limit_req zone=api_limit burst=20 nodelay;
|
|
||||||
proxy_pass http://127.0.0.1:5000;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
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 30s;
|
|
||||||
}
|
|
||||||
|
|
||||||
# ── Static website (optional landing page) ───────────────────────────
|
|
||||||
location / {
|
|
||||||
root /var/www/revolt;
|
|
||||||
index index.html;
|
|
||||||
try_files $uri $uri/ =404;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Redirect HTTP → HTTPS
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name getrevolt.app;
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user