cb5b4c42de
- main.py: Redis主Worker选举,防止多Worker重复执行后台任务
- agent.py: 告警/恢复广播使用真实服务器名(查MySQL)替代"server-{id}"
- sync_v2.py: 修复browse目录解析死代码,正确取parts[8]
- install.html: 移除过时install.php引用,更新为"删除.env重装"
- nginx配置: 移除PHP-FPM路由(install.html纯静态无需PHP)
- schedule_runner: 清理未使用的get_redis_sync导入
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
102 lines
2.9 KiB
Plaintext
102 lines
2.9 KiB
Plaintext
# Nexus v6.0 — Nginx Production Config (HTTPS Template)
|
|
# *** Copy this file and replace ALL {{PLACEHOLDER}} values before deploying ***
|
|
#
|
|
# {{SERVER_NAME}} = your domain (e.g. nexus.example.com)
|
|
# {{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)
|
|
# {{SSL_CERT}} = SSL certificate fullchain path
|
|
# {{SSL_KEY}} = SSL private key path
|
|
|
|
# ── Upstream: Python FastAPI backend ──
|
|
upstream nexus_api {
|
|
server 127.0.0.1:8600;
|
|
keepalive 32;
|
|
}
|
|
|
|
# ── HTTP → HTTPS redirect ──
|
|
server {
|
|
listen 80;
|
|
server_name {{SERVER_NAME}};
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
# ── HTTPS ──
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name {{SERVER_NAME}};
|
|
|
|
# SSL
|
|
ssl_certificate {{SSL_CERT}};
|
|
ssl_certificate_key {{SSL_KEY}};
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
ssl_prefer_server_ciphers on;
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_session_timeout 10m;
|
|
|
|
# HSTS
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
|
|
# 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 (cache aggressively) ──
|
|
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\.php$ {
|
|
deny all;
|
|
}
|
|
|
|
# ── Static HTML pages (no SPA — each page is standalone) ──
|
|
location / {
|
|
try_files $uri $uri/ =404;
|
|
}
|
|
|
|
# ── Logging ──
|
|
access_log {{LOG_DIR}}/{{SERVER_NAME}}.log;
|
|
error_log {{LOG_DIR}}/{{SERVER_NAME}}.error.log;
|
|
|
|
# ── Upload limit ──
|
|
client_max_body_size 100m;
|
|
}
|