80 lines
2.3 KiB
Plaintext
80 lines
2.3 KiB
Plaintext
|
|
# Nexus v6.0 — Nginx Reverse Proxy Config (Template)
|
||
|
|
# *** Copy this file and replace ALL {{PLACEHOLDER}} values before deploying ***
|
||
|
|
#
|
||
|
|
# {{SERVER_NAME}} = your domain or IP (e.g. nexus.example.com or 192.168.1.100)
|
||
|
|
# {{DEPLOY_DIR}} = installation root (e.g. /opt/nexus or /www/wwwroot/nexus.example.com)
|
||
|
|
# {{LOG_DIR}} = nginx log directory (e.g. /var/log/nginx or /www/wwwlogs)
|
||
|
|
|
||
|
|
# ── Upstream: Python FastAPI backend ──
|
||
|
|
upstream nexus_api {
|
||
|
|
server 127.0.0.1:8600;
|
||
|
|
keepalive 32;
|
||
|
|
}
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name {{SERVER_NAME}};
|
||
|
|
|
||
|
|
# Document root = frontend static files
|
||
|
|
root {{DEPLOY_DIR}}/web/app;
|
||
|
|
index index.html;
|
||
|
|
|
||
|
|
# ── Python API proxy ──
|
||
|
|
location /api/ {
|
||
|
|
proxy_pass http://nexus_api;
|
||
|
|
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 300s;
|
||
|
|
proxy_send_timeout 300s;
|
||
|
|
proxy_connect_timeout 10s;
|
||
|
|
}
|
||
|
|
|
||
|
|
# ── WebSocket proxy (alerts + WebSSH terminal) ──
|
||
|
|
location /ws/ {
|
||
|
|
proxy_pass http://nexus_api;
|
||
|
|
proxy_http_version 1.1;
|
||
|
|
proxy_set_header Upgrade $http_upgrade;
|
||
|
|
proxy_set_header Connection "upgrade";
|
||
|
|
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 3600s;
|
||
|
|
proxy_send_timeout 3600s;
|
||
|
|
}
|
||
|
|
|
||
|
|
# ── Health endpoint ──
|
||
|
|
location /health {
|
||
|
|
proxy_pass http://nexus_api;
|
||
|
|
proxy_set_header Host $host;
|
||
|
|
}
|
||
|
|
|
||
|
|
# ── Static assets ──
|
||
|
|
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||
|
|
expires 7d;
|
||
|
|
add_header Cache-Control "public, immutable";
|
||
|
|
try_files $uri =404;
|
||
|
|
}
|
||
|
|
|
||
|
|
# ── Deny sensitive files ──
|
||
|
|
location ~ /\. {
|
||
|
|
deny all;
|
||
|
|
}
|
||
|
|
location ~ /data/config\.json$ {
|
||
|
|
deny all;
|
||
|
|
}
|
||
|
|
|
||
|
|
# ── Static HTML pages (no SPA — each page is standalone) ──
|
||
|
|
location / {
|
||
|
|
try_files $uri $uri/ =404;
|
||
|
|
}
|
||
|
|
|
||
|
|
# ── Logging ──
|
||
|
|
access_log {{LOG_DIR}}/{{SERVER_NAME}}_nexus.log;
|
||
|
|
error_log {{LOG_DIR}}/{{SERVER_NAME}}_nexus.error.log;
|
||
|
|
|
||
|
|
# ── Upload limit ──
|
||
|
|
client_max_body_size 500m;
|
||
|
|
}
|