Files
ai_site/nginx/README.md
2026-07-31 10:31:17 +08:00

54 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Nginx 与可热重载配置Linux Docker 部署)
AI 建站默认用 **Docker web 容器**`127.0.0.1:5173`)对外提供页面,并在容器内把 `/api/``/ai/` 反代到 gateway。
若需 **独立域名 + HTTPS**(与同机 yh_web 并存),用 **宿主机 Nginx** 反代到 `5173`,不要与宇恒抢同一 `server_name`
## 配置文件映射(改完可只 reload / 单容器 restart
| 用途 | 仓库路径 | 生效方式 |
|------|----------|----------|
| 容器 Web 反代 | `web/nginx.conf` | `./reload-config.sh web` |
| Platform | `platform/etc/platform.docker.yaml` | `./reload-config.sh platform` |
| Gateway | `gateway/etc/gateway.docker.yaml` | `./reload-config.sh gateway` |
| LLM / 视觉 | `.env` | `./reload-config.sh ai` |
| 供应商与模型 | `ai-service/etc/llm.yaml` | `./reload-config.sh ai` |
| 宿主机域名 HTTPS | `nginx/aijz.host.conf``/etc/nginx/conf.d/` | `./reload-config.sh host-nginx` |
| SSL 证书 | `nginx/<域名>.pem` + `.key``/etc/ssl/aijianzhan/<域名>/` | `./reload-config.sh host-nginx` |
| 域名验证文件 | `verify-root/` | `./reload-config.sh host-nginx` |
| 前端静态 | `web/dist/` | 覆盖文件即可,无需重启 |
## 启用宿主机 Nginx可选
`.env` 中:
```bash
AIJZ_DOMAIN=aijz.example.com
AIJZ_ENABLE_HOST_NGINX=1
AIJZ_PUBLIC_BASE_URL=https://aijz.example.com
```
证书可放在项目 `nginx/` 下(与 yh_web 相同命名习惯):
- `nginx/aijz.example.com.pem` + `nginx/aijz.example.com.key`
-`nginx/fullchain.pem` + `nginx/privkey.pem`
然后:
```bash
./start.sh # 或 ./restart.sh会自动同步证书并生成 /etc/nginx/conf.d/<域名>.conf
./reload-config.sh host-nginx # 仅改 Nginx/证书/verify-root 时
```
## 常用命令
```bash
./reload-config.sh # 全部轻量重载(不 rebuild、不重建 dist
./reload-config.sh web # 容器 nginx -s reload
./reload-config.sh platform # 只 restart platform读新 yaml
./reload-config.sh gateway # 只 restart gateway
./reload-config.sh host-nginx # nginx -t && systemctl reload nginx
```
整栈重建仍用 `./restart.sh``./pull-and-restart.sh`