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:
@@ -64,6 +64,7 @@ AI 和语音密钥由后端 Settings API 保存并由代理使用,前端不再
|
||||
- `DATABASE_URL`:PostgreSQL 连接串。Docker Compose 暴露到宿主机的默认端口是 `5433`,容器内部仍使用 `db:5432`。
|
||||
- `SESSION_SECRET`:Session Cookie 签名密钥。
|
||||
- `SESSION_COOKIE_SECURE`:是否只通过 HTTPS 发送 Session Cookie。本地 HTTP/Compose 默认 `false`,生产 HTTPS 应设为 `true`。
|
||||
- `TRUST_PROXY`:是否信任反向代理传入的 `X-Forwarded-*` 头。`# XXX` 公网 HTTPS 经过 Nginx Proxy Manager、frpc/frps 或其他反向代理转发时建议设为 `true`。
|
||||
- `FILE_STORAGE_DIR`:后端文件目录。Docker Compose 默认 `/app/uploads`,并挂载到 `uploads_data` volume。
|
||||
- `RUN_DB_MIGRATIONS`:Docker API 容器启动时是否执行 `prisma migrate deploy`,默认 `true`。
|
||||
- `RUN_DB_SEED`:Docker API 容器启动时是否执行 `prisma db seed`,默认 `true`。
|
||||
@@ -97,6 +98,38 @@ docker-compose up -d --build
|
||||
|
||||
更完整的 Docker 说明、生产变量、证书和备份恢复见 [Docker 化部署](./docker.md)。
|
||||
|
||||
## 公网反向代理
|
||||
|
||||
<!-- # XXX 公网部署新增:适用于本机 Docker 4002 端口经 frpc 映射到公网服务器,再由 Nginx Proxy Manager 绑定域名。 -->
|
||||
|
||||
推荐链路:
|
||||
|
||||
```text
|
||||
浏览器 https://sstwbg.example.com
|
||||
-> 公网服务器 Nginx Proxy Manager
|
||||
-> frps/frpc 映射端口
|
||||
-> 本机 Docker web:4002
|
||||
-> 容器 Nginx /api
|
||||
-> api:3100
|
||||
```
|
||||
|
||||
公网部署建议变量:
|
||||
|
||||
```bash
|
||||
# XXX HTTPS 生产入口建议开启安全 Cookie,并让后端信任外层代理协议头。
|
||||
export SESSION_SECRET="替换为足够长的随机字符串"
|
||||
export SESSION_COOKIE_SECURE="true"
|
||||
export TRUST_PROXY="true"
|
||||
docker-compose up -d --build
|
||||
```
|
||||
|
||||
Nginx Proxy Manager 代理 `sstwbg.example.com` 时:
|
||||
|
||||
- 代理目标指向 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;`。
|
||||
|
||||
## 麦克风访问
|
||||
|
||||
浏览器不允许普通局域网 HTTP 页面调用麦克风,代码无法绕过这个限制。Docker 演示环境建议使用:
|
||||
|
||||
Reference in New Issue
Block a user