server { listen 80; server_name _; root /opt/backupx/web; index index.html; location /api/ { proxy_pass http://127.0.0.1:8340/api/; 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_set_header Connection ""; proxy_buffering off; proxy_cache off; proxy_read_timeout 3600s; } # Agent 一键安装脚本路径(兼容 v2.0 及之前生成的命令)。 # v2.1+ 新生成的命令走 /api/install/... 自动命中上面的 /api/ 代理。 location /install/ { proxy_pass http://127.0.0.1:8340/install/; 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; } # 健康检查端点同样不走 SPA fallback。 location = /health { proxy_pass http://127.0.0.1:8340/health; } location = /ready { proxy_pass http://127.0.0.1:8340/ready; } location = /metrics { proxy_pass http://127.0.0.1:8340/metrics; } location / { try_files $uri $uri/ /index.html; } }