Files
iAOP/deploy/fba/nginx-fba.conf
T
bot_dev1 9994fb75e7 fix(#188): bot_qa 审核修正——nginx 改无 URI proxy_pass 真透传 + 健康探针 /health 无前缀
打回问题 1:proxy_pass 带末尾 / 是去前缀语义(与声称相反),/v1/models
会被转发成 /models 导致 404。改为不带 URI 的 proxy_pass(无末尾 /),
请求 URI 原样透传;另新增 location = /health 精确透传健康探针。
打回问题 2:serve.py 健康路由是 GET /health(无 /v1 前缀),fetchHealth
由 /v1/health 改回 /health;同步修正 chat/NlQuery/cockpit 三处文案注释。
构建验证:pnpm --filter @vben/web-antdv-next build 通过(10.3s)。
2026-08-06 16:48:14 +08:00

102 lines
4.0 KiB
Plaintext
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.
# =============================================================================
# iAOP nginx 片段:将 /fba/ 前缀反代到 FBA 后端(127.0.0.1:8001)
#
# 用法:由运维将本文件 include 进现有 iAOP 站点的 server 块
# (与 8090 现有 location 并列),例如:
#
# server {
# listen 8090;
# ... 现有 iAOP 配置 ...
# include /opt/apps/iAOP/deploy/fba/nginx-fba.conf;
# }
#
# 路径映射:/fba/api/v1/auth/login → http://127.0.0.1:8001/api/v1/auth/login
# 说明:FBA 后端所有接口都在 /api/v1 之下,FBA UI 请求形如
# ${VITE_GLOB_API_URL}/api/v1/...,因此部署 FBA UI 时应将其
# VITE_GLOB_API_URL 配置为 https://<域名>/fba
# =============================================================================
location /fba/ {
# 去掉 /fba 前缀后转发
proxy_pass http://127.0.0.1:8001/;
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;
# FBA 登录/刷新 token 走 cookie + bearer,允许凭据
proxy_http_version 1.1;
proxy_set_header Connection "";
# 上传接口(sys/files)可能较大
client_max_body_size 50m;
proxy_read_timeout 60s;
}
# =============================================================================
# Phase 3:FBA UI 静态站点(用户/角色/菜单/日志管理界面)
#
# 部署:将 deploy/fba/artifacts/fba-ui-dist.tar.gz 解压到
# /opt/apps/iAOP/deploy/fba/fba-ui/(解压后应存在 fba-ui/dist/index.html)
# tar -xzf deploy/fba/artifacts/fba-ui-dist.tar.gz -C deploy/fba/fba-ui/
#
# 产物构建参数(已固化在包内):
# VITE_BASE=/fba-admin/
# VITE_GLOB_API_URL=http://39.101.182.167:8090/fba
# 入口:http://39.101.182.167:8090/fba-admin/
# =============================================================================
location /fba-admin/ {
alias /opt/apps/iAOP/deploy/fba/fba-ui/dist/;
index index.html;
# SPA 路由回退(hash 模式下 mostly 用不到,兜底)
try_files $uri $uri/ /fba-admin/index.html;
# 带 hash 的静态资源长缓存;index.html 不缓存
location ~* \.(js|css|png|jpg|jpeg|gif|svg|woff2?)$ {
expires 7d;
add_header Cache-Control "public";
}
location = /fba-admin/index.html {
add_header Cache-Control "no-cache";
}
}
# =============================================================================
# 推理通道(iAOP LLM 网关)
#
# issue #188(bot_qa 审核修正):推理服务真实路径为
# POST /v1/chat/completions、GET /v1/models(带 /v1 前缀)
# GET /health(健康探针,**无 /v1 前缀**,见 deploy/k8s/docker/serve.py)
#
# 注意 nginx 语义:proxy_pass 带 URI 部分(含末尾 /)时会把 location 匹配
# 前缀**替换**掉(即"去前缀",同上方 /fba/ 块用法);要"原样透传"必须
# 使用不带 URI 的 proxy_pass(无末尾 /),请求 URI 完整转发给后端。
# 前端 infer.ts BASE_URL 为空串,统一写 /v1/models、/v1/chat/completions、/health。
# =============================================================================
location /v1/ {
# 不带 URI(无末尾 /):/v1/models → :30800/v1/models 原样透传
proxy_pass http://127.0.0.1:30800;
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;
client_max_body_size 20m;
proxy_read_timeout 120s;
}
# 健康探针无前缀,单独精确透传:/health → :30800/health
location = /health {
proxy_pass http://127.0.0.1:30800;
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;
}