5590391779
Agent (agent.py): - Rebrand MultiSync → Nexus throughout - Add server_id to heartbeat payload (required by backend AgentHeartbeat schema) - Add /exec endpoint for remote command execution via Nexus - Update heartbeat fields to match backend: cpu_usage, mem_usage, disk_usage - Use 60s default interval (matches CLAUDE.md spec) Agent (agent.sh): - Rebrand, add SERVER_ID env var, send in heartbeat payload - Update service name to nexus-agent Agent (install.sh): - Rebrand, add --id parameter for server_id - Write server_id to config.json - Service name: nexus-agent - Add config.example.json for reference SyncEngineV2: - Add trigger_type parameter to sync_files() (was hardcoded "manual") - Schedule/retry runners can now pass "schedule"/"retry" trigger types Nginx: - Add /agent/ to static asset locations for agent file downloads Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
112 lines
3.3 KiB
Plaintext
112 lines
3.3 KiB
Plaintext
# Nexus v6.0 — Nginx Production Config (HTTPS)
|
|
# Domain: api.synaglobal.vip (宝塔面板管理)
|
|
# Backend: uvicorn 0.0.0.0:8600
|
|
# Frontend: /www/wwwroot/api.synaglobal.vip/web/app/ (Tailwind CSS v4 + Alpine.js)
|
|
|
|
# ── Upstream: Python FastAPI backend ──
|
|
upstream nexus_api {
|
|
server 127.0.0.1:8600;
|
|
keepalive 32;
|
|
}
|
|
|
|
# ── HTTP → HTTPS redirect ──
|
|
server {
|
|
listen 80;
|
|
server_name api.synaglobal.vip;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
# ── HTTPS ──
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name api.synaglobal.vip;
|
|
|
|
# SSL (宝塔面板自动管理证书)
|
|
ssl_certificate /www/server/panel/vhost/cert/api.synaglobal.vip/fullchain.pem;
|
|
ssl_certificate_key /www/server/panel/vhost/cert/api.synaglobal.vip/privkey.pem;
|
|
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 = new Tailwind app directory
|
|
root /www/wwwroot/api.synaglobal.vip/web/app;
|
|
index index.html;
|
|
|
|
# ── install.php (PHP-FPM for installer, root = /web/) ──
|
|
location ~ ^/install\.php$ {
|
|
root /www/wwwroot/api.synaglobal.vip/web;
|
|
fastcgi_pass unix:/tmp/php-cgi-82.sock;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
include fastcgi_params;
|
|
}
|
|
|
|
# ── Installer + Agent assets (root = /web/) ──
|
|
location ~ ^/(css|js|vendor|agent)/ {
|
|
root /www/wwwroot/api.synaglobal.vip/web;
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# ── 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 /www/wwwlogs/api.synaglobal.vip.log;
|
|
error_log /www/wwwlogs/api.synaglobal.vip.error.log;
|
|
|
|
# ── Upload limit ──
|
|
client_max_body_size 100m;
|
|
}
|