From f8e0a51314516abf888944b81e236bde8a44406d Mon Sep 17 00:00:00 2001 From: zhangjf Date: Mon, 23 Feb 2026 10:53:04 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=89=8D=E7=AB=AF=E9=83=A8=E7=BD=B2=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 部署路径更新: - fund-admin 部署路径: /fadmin/ - fund-mobile 部署路径: /fmobile/ - API网关前缀: /fund 更新内容: 1. 部署运维文档.md - 本地开发访问地址添加移动端H5 - Docker Compose架构图更新前端访问路径 - 服务清单添加访问路径说明 - Nginx配置示例更新为子路径部署 2. 单机部署文档.md - 部署架构图更新前端路径 - 前端打包说明添加部署脚本和子路径说明 - 新增4.5 Nginx配置章节 - 添加前端解压部署步骤 --- doc/单机部署文档.md | 64 ++++++++++++++++++++++++++++++++++++++++++--- doc/部署运维文档.md | 27 ++++++++++++------- 2 files changed, 78 insertions(+), 13 deletions(-) diff --git a/doc/单机部署文档.md b/doc/单机部署文档.md index c13482e..94d3400 100644 --- a/doc/单机部署文档.md +++ b/doc/单机部署文档.md @@ -17,7 +17,7 @@ │ │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ 前端服务 │ │ -│ │ fund-admin (Nginx:80) fund-mobile (Nginx:81) │ │ +│ │ fund-admin (/fadmin/) fund-mobile (/fmobile/) │ │ │ └─────────────────────────┬───────────────────────────────┘ │ │ │ │ │ ┌─────────────────────────▼───────────────────────────────┐ │ @@ -431,7 +431,17 @@ fundplatform/ #### 4.2.4 前端打包 +前端项目采用 Nginx 子路径部署方式: +- **管理后台** (fund-admin): 部署路径 `/fadmin/` +- **移动端H5** (fund-mobile): 部署路径 `/fmobile/` +- **API网关前缀**: `/fund` + ```bash +# 使用部署脚本打包(推荐) +./scripts/deploy-frontend-nginx.sh admin # 管理后台 +./scripts/deploy-frontend-nginx.sh mobile # 移动端H5 + +# 或手动打包 # 管理后台打包 cd fund-admin npm install @@ -485,6 +495,54 @@ tar -xzf fund-receipt.tar.gz -C /opt/fundplatform/deploy/ tar -xzf fund-report.tar.gz -C /opt/fundplatform/deploy/ tar -xzf fund-file.tar.gz -C /opt/fundplatform/deploy/ +# 解压前端发布包 +mkdir -p /opt/fundplatform/web +unzip fund-admin-nginx.zip -d /opt/fundplatform/web/admin/ +unzip fund-mobile-nginx.zip -d /opt/fundplatform/web/mobile/ + +# 复制Nginx配置 +cp /opt/fundplatform/web/admin/nginx.conf /etc/nginx/conf.d/fadmin.conf +cp /opt/fundplatform/web/mobile/nginx.conf /etc/nginx/conf.d/fmobile.conf + +``` + +### 4.5 Nginx 配置 + +前端采用子路径部署,Nginx 配置示例: + +```nginx +# /etc/nginx/conf.d/fundplatform.conf +server { + listen 80; + server_name localhost; + + # 管理后台 (部署路径: /fadmin/) + location /fadmin/ { + alias /opt/fundplatform/web/admin/; + try_files $uri $uri/ /fadmin/index.html; + } + + # 移动端H5 (部署路径: /fmobile/) + location /fmobile/ { + alias /opt/fundplatform/web/mobile/; + try_files $uri $uri/ /fmobile/index.html; + } + + # API代理 (网关前缀: /fund) + location /fund/ { + proxy_pass http://127.0.0.1:8000/; + 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; + } +} +``` + +**访问地址**: +- 管理后台: `http://服务器IP/fadmin/` +- 移动端H5: `http://服务器IP/fmobile/` + ```bash # 上传一键管理脚本到deploy目录(在解压服务包后执行) # 一键管理脚本位于项目根目录scripts目录,需要单独上传 @@ -494,7 +552,7 @@ cp scripts/restart-all.sh /opt/fundplatform/deploy/ cp scripts/status-all.sh /opt/fundplatform/deploy/ ``` -### 4.5 配置文件修改 +### 4.6 配置文件修改 各服务配置文件需要根据实际环境修改以下配置: @@ -521,7 +579,7 @@ spring: namespace: fund-platform ``` -### 4.6 服务管理脚本 +### 4.7 服务管理脚本 每个服务的 `bin` 目录下包含以下脚本: diff --git a/doc/部署运维文档.md b/doc/部署运维文档.md index 584cf18..7c7a207 100644 --- a/doc/部署运维文档.md +++ b/doc/部署运维文档.md @@ -158,6 +158,7 @@ npm run dev # 4. 访问系统 # 管理后台:http://localhost:3000 +# 移动端H5:http://localhost:8080 # 网关地址:http://localhost:8000 # Nacos 控制台:http://localhost:8048/nacos # Grafana 监控:http://localhost:3000 (Docker环境) 或 http://localhost:3001 (本地开发) @@ -179,8 +180,8 @@ npm run dev │ │ │ ┌──────────────┐ │ │ │ 前端服务 │ │ -│ │ fund-admin │ ← 管理后台 (http://localhost:80) │ -│ │ fund-mobile │ ← 移动端H5 (http://localhost:81) │ +│ │ fund-admin │ ← 管理后台 (http://localhost/fadmin/) │ +│ │ fund-mobile │ ← 移动端H5 (http://localhost/fmobile/) │ │ └──────┬───────┘ │ │ │ │ │ ┌──────┴───────┐ │ @@ -224,8 +225,8 @@ npm run dev | 服务 | 端口 | 说明 | |------|------|------| -| fund-admin | 80 | 管理后台前端 | -| fund-mobile | 81 | 移动端H5 | +| fund-admin | 80 | 管理后台前端 (访问路径: /fadmin/) | +| fund-mobile | 80 | 移动端H5 (访问路径: /fmobile/) | | gateway | 8000 | API网关 | | fund-sys | 8100 | 系统管理服务 | | fund-sys-vip001 | 8101 | 系统服务VIP专属实例 | @@ -480,14 +481,20 @@ server { listen 80; server_name test.fundplatform.com; - # 前端静态资源 - location / { - root /opt/fundplatform/admin; - try_files $uri $uri/ /index.html; + # 管理后台前端 (部署路径: /fadmin/) + location /fadmin/ { + alias /opt/fundplatform/admin/; + try_files $uri $uri/ /fadmin/index.html; } - # API 代理 - location /api/ { + # 移动端H5 (部署路径: /fmobile/) + location /fmobile/ { + alias /opt/fundplatform/mobile/; + try_files $uri $uri/ /fmobile/index.html; + } + + # API 代理 (网关前缀: /fund) + location /fund/ { proxy_pass http://gateway/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr;