This commit is contained in:
Kevin Wong
2026-01-26 12:18:54 +08:00
parent c918dc6faf
commit f99bd336c9
16 changed files with 417 additions and 30 deletions

View File

@@ -251,6 +251,47 @@ pm2 stop vigent2-latentsync # 停止 LatentSync 服务
pm2 delete all # 删除所有服务
```
---
## 步骤 10: 配置 Nginx HTTPS (可选 - 公网访问)
如果您需要通过公网域名 HTTPS 访问 (如 `https://vigent.hbyrkj.top`),请参考以下 Nginx 配置。
**前置条件**
1. 已申请 SSL 证书 (如 Let's Encrypt)。
2. 使用 FRP 或其他方式将本地 3002 端口映射到服务器。
**配置示例** (`/etc/nginx/conf.d/vigent.conf`):
```nginx
server {
listen 80;
server_name your.domain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name your.domain.com;
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
location / {
proxy_pass http://127.0.0.1:3002; # 转发给 Next.js 前端
# 必须配置 WebSocket 支持,否则热更和即时通信失效
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;
}
}
```
---
## 故障排除

88
Docs/DevLogs/Day10.md Normal file
View File

@@ -0,0 +1,88 @@
---
## 🔧 隧道访问与视频播放修复 (11:00)
### 问题描述
在通过 FRP 隧道 (如 `http://8.148.x.x:3002`) 访问时发现:
1. **视频无法播放**:后端返回 404 (Not Found)。
2. **发布页账号列表为空**:后端返回 500 (Internal Server Error)。
### 解决方案
#### 1. 视频播放修复
- **后端 (`main.py`)**:这是根源问题。后端缺少 `uploads` 目录的挂载,导致静态资源无法访问。
```python
app.mount("/uploads", StaticFiles(directory=str(settings.UPLOAD_DIR)), name="uploads")
```
- **前端 (`next.config.ts`)**:添加反向代理规则,将 `/outputs` 和 `/uploads` 转发到后端端口 8006。
```typescript
{
source: '/uploads/:path*',
destination: 'http://localhost:8006/uploads/:path*',
},
{
source: '/outputs/:path*',
destination: 'http://localhost:8006/outputs/:path*',
}
```
#### 2. 账号列表 500 错误修复
- **根源**`backend/app/core/paths.py` 中的白名单缺少 `weixin` 和 `kuaishou`。
- **现象**:当 `PublishService` 遍历所有平台时,遇到未在白名单的平台直接抛出 `ValueError`,导致整个接口崩溃。
- **修复**:更新白名单。
```python
VALID_PLATFORMS: Set[str] = {"bilibili", "douyin", "xiaohongshu", "weixin", "kuaishou"}
```
### 结果
- ✅ 视频预览和历史视频均可正常播放。
- ✅ 发布页账号列表恢复显示。
---
## 🚀 Nginx HTTPS 部署 (11:30)
### 需求
用户在阿里云服务器上配置了 SSL 证书,需要通过 HTTPS 访问应用。
### 解决方案
提供了 Nginx 配置文件 `nginx_vigent.conf`,配置了:
1. **HTTP -> HTTPS 重定向**。
2. **SSL 证书路径** (`/etc/letsencrypt/live/vigent.hbyrkj.top/...`)。
3. **反向代理** 到本地 FRP 端口 (3002)。
4. **WebSocket 支持** (用于 Next.js 热更和通信)。
### 结果
- ✅ 用户可通过 `https://vigent.hbyrkj.top` 安全访问。
- ✅ 代码自适应:前端 `API_BASE` 为空字符串,自动适配 HTTPS 协议,无需修改代码。
---
## 🎨 UI 细节优化 (11:45)
### 修改
- 修改 `frontend/src/app/layout.tsx` 中的 Metadata。
- 标题从 `Create Next App` 改为 `ViGent`。
### 结果
- ✅ 浏览器标签页名称已更新。
---
## 🚪 用户登录退出功能 (12:00)
### 需求
用户反馈没有退出的入口。
### 解决方案
- **UI 修改**:在首页和发布管理页面的顶部导航栏添加红色的“退出”按钮 (位于最右侧)。
- **逻辑实现**
```javascript
onClick={async () => {
if (confirm('确定要退出登录吗?')) {
await fetch(`${API_BASE}/api/auth/logout`, { method: 'POST' });
window.location.href = '/login';
}
}}
```
- **部署**:已同步代码并重建前端。

204
Docs/Logs.md Normal file
View File

@@ -0,0 +1,204 @@
rongye@r730-ubuntu:~/ProgramFiles/ViGent2$ pm2 logs vigent2-latentsync
[TAILING] Tailing last 15 lines for [vigent2-latentsync] process (change the value with --lines option)
/home/rongye/.pm2/logs/vigent2-latentsync-out.log last 15 lines:
/home/rongye/.pm2/logs/vigent2-latentsync-error.log last 15 lines:
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
15|vigent2 | INFO: Started server process [1437489]
15|vigent2 | INFO: Waiting for application startup.
15|vigent2 | INFO: Application startup complete.
15|vigent2 | INFO: Uvicorn running on http://0.0.0.0:8007 (Press CTRL+C to quit)
rongye@r730-ubuntu:~/ProgramFiles/ViGent2$ pm2 logs vigent2-frontend
[TAILING] Tailing last 15 lines for [vigent2-frontend] process (change the value with --lines option)
/home/rongye/.pm2/logs/vigent2-frontend-error.log last 15 lines:
11|vigent2 | at ignore-listed frames
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2 | at ignore-listed frames
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2 | at ignore-listed frames
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2 | at ignore-listed frames
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2 | at ignore-listed frames
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2 | at ignore-listed frames
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2 | at ignore-listed frames
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2 | at ignore-listed frames
/home/rongye/.pm2/logs/vigent2-frontend-out.log last 15 lines:
11|vigent2 |
11|vigent2 | ✓ Starting...
11|vigent2 |
11|vigent2 | > frontend@0.1.0 start
11|vigent2 | > next start -p 3002 -p 3002
11|vigent2 |
11|vigent2 | ▲ Next.js 16.1.1
11|vigent2 | - Local: http://localhost:3002
11|vigent2 | - Network: http://192.168.110.200:3002
11|vigent2 |
11|vigent2 | ✓ Starting...
11|vigent2 |
11|vigent2 | > frontend@0.1.0 start
11|vigent2 | > next start -p 3002 -p 3002
11|vigent2 |
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames
11|vigent2-frontend | > frontend@0.1.0 start
11|vigent2-frontend | > next start -p 3002 -p 3002
11|vigent2-frontend | ▲ Next.js 16.1.1
11|vigent2-frontend | - Local: http://localhost:3002
11|vigent2-frontend | - Network: http://192.168.110.200:3002
11|vigent2-frontend | ✓ Starting...
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
11|vigent2-frontend | at ignore-listed frames

View File

@@ -2,8 +2,8 @@
**项目**ViGent2 数字人口播视频生成系统
**服务器**Dell R730 (2× RTX 3090 24GB)
**更新时间**2026-01-23
**整体进度**100%Day 9 部署稳定性优化完成
**更新时间**2026-01-26
**整体进度**100%Day 10 HTTPS 部署与细节完善
## 📖 快速导航
@@ -138,6 +138,13 @@
- [x] 部署服务自愈 (PM2 配置优化)
- [x] 部署手册全量更新 (DEPLOY_MANUAL.md)
### 阶段十六HTTPS 部署与细节完善 (Day 10)
- [x] 隧道访问修复 (StaticFiles 挂载 + Rewrite)
- [x] 平台账号列表 500 错误修复 (paths.py)
- [x] Nginx HTTPS 配置 (反向代理 + SSL)
- [x] 浏览器标题修改 (ViGent)
- [x] 代码自适应 HTTPS 验证
---
## 🛤️ 后续规划
@@ -301,5 +308,11 @@ Day 9: 发布模块优化 ✅ 完成
- 前端生产构建流程修复
- LatentSync 严重卡顿修复 (线程数限制)
- 部署手册全量更新
Day 10: HTTPS 部署与细节完善 ✅ 完成
- 隧道访问视频修正 (挂载 uploads)
- 账号列表 Bug 修复 (paths.py 白名单)
- 阿里云 Nginx HTTPS 部署
- UI 细节优化 (Title 更新)
```