Document public reverse proxy deployment

- Add README instructions for deploying the full report system through local Docker port 4002, frpc, Nginx Proxy Manager, and sstwbg.example.com.

- Document required HTTPS, WebSocket, request-size, timeout, health-check, login, AI, video-frame, and speech verification steps.

- Add TRUST_PROXY support so secure session cookies work behind public HTTPS reverse proxies.

- Preserve upstream X-Forwarded-Proto through the container Nginx API proxy.

- Allow Docker Compose session and trust-proxy variables to be overridden for public deployments.

- Update deployment and Docker docs with the same public reverse-proxy guidance.
This commit is contained in:
2026-05-08 16:27:12 +08:00
parent 6bdb12678a
commit 3313811d2f
7 changed files with 162 additions and 4 deletions

View File

@@ -110,8 +110,34 @@ https://localhost:4443
- 使用医院内网域名。
- 通过可信 CA 或内网 CA 签发证书。
-`SESSION_COOKIE_SECURE` 设为 `true`
-`TRUST_PROXY` 设为 `true``# XXX` 如果 HTTPS 在 Nginx Proxy Manager、frpc/frps 等外层代理终止,后端需要信任 `X-Forwarded-Proto` 才能正确写入安全 Cookie。
-`CORS_ORIGIN` 改成真实前端 HTTPS 来源。
## 公网域名反向代理
<!-- # XXX 公网部署新增:适用于本机 Docker 4002 端口经 frpc 映射到公网服务器,再由 Nginx Proxy Manager 绑定 sstwbg.example.com。 -->
如果使用 `本机 Docker 4002 -> frpc -> 公网服务器 Nginx Proxy Manager -> sstwbg.example.com`,推荐流程:
```bash
# XXX 使用公网 HTTPS 入口时compose 变量可从 shell 或 .env 覆盖。
export SESSION_SECRET="替换为足够长的随机字符串"
export SESSION_COOKIE_SECURE="true"
export TRUST_PROXY="true"
docker-compose up -d --build
```
Nginx Proxy Manager 配置要点:
- `Domain Names` 使用 `sstwbg.example.com`
- `Forward Hostname / IP` 指向 frpc 在公网服务器暴露的地址。
- `Forward Port` 填 frpc 暴露的端口,例如 `4002`
- 开启 `Websockets Support`,保证 `/api/speech/iat` 语音听写 WebSocket 可升级。
- SSL 页签绑定证书并开启 `Force SSL`,保证浏览器开放麦克风权限。
- Advanced 中建议设置 `client_max_body_size 100m;``proxy_read_timeout 3600s;``proxy_send_timeout 3600s;`
公网验收先访问 `https://sstwbg.example.com/api/health`再登录并测试报告保存、视频抽帧、AI 对话和语音听写。
## 生产部署前必须修改
`docker-compose.yaml` 当前适合演示和院内试运行,生产前至少修改:
@@ -121,6 +147,7 @@ https://localhost:4443
- `SESSION_SECRET`:替换为高强度随机值。
- `CORS_ORIGIN`:只保留真实前端来源。
- `SESSION_COOKIE_SECURE`HTTPS 部署时设为 `true`
- `TRUST_PROXY`:经反向代理提供 HTTPS 时设为 `true`
- `RUN_DB_SEED`:不需要每次启动 seed 时可设为 `false`
- AI/讯飞演示凭据:通过系统设置替换为正式凭据;已经暴露过的密钥应轮换。
- HTTPS 证书:替换自签名本机证书。