Files
Nexus/docs/changelog/2026-06-23-detect-path-nginx-root.md
T
2026-07-08 22:31:31 +08:00

1.5 KiB
Raw Blame History

检测路径改为 nginx 网站目录

日期2026-06-23

变更摘要

批量「检测路径」由搜索 workerman.bat 改为读取 nginx 虚拟主机配置中的 root 网站目录,并写入 target_path

动机

站点目录应以 nginx 配置为准;workerman.bat 并非通用标志,大量服务器检测失败。

检测逻辑

  1. 取服务器 domain(域名或 IP
  2. SSH 远程执行:
    • 优先 /www/server/panel/vhost/nginx/{domain}.conf(宝塔)
    • 再扫描宝塔 vhost 中 server_name 匹配项
    • 最后尝试 /etc/nginx/sites-enabled/etc/nginx/conf.d
  3. 解析首个 root 指令,校验为合法绝对路径后写入 DB

涉及文件

文件 变更
server/utils/nginx_path_detect.py 新增:构建远程检测命令
server/application/server_batch_common.py detect_and_save_target_path 改用 nginx
frontend/src/pages/ServersPage.vue 确认对话框文案
scripts/batch_detect_target_path.py 脚本说明
tests/test_nginx_path_detect.py 单元测试
docs/project/nexus-functional-development-guide.md 功能说明

迁移 / 重启

无需 DB 迁移;后端热更新或重启 API 即可。前端需 vite build 后部署。

验证

.venv/bin/pytest tests/test_nginx_path_detect.py tests/test_server_onboarding.py -q

服务器页勾选多台 →「检测路径」→ 确认说明含 nginx root → 任务结果 target_path → /www/wwwroot/...