40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
# 抖音客服系统 - Nginx 反向代理示例(可选)
|
||
# 若已用 start_web.sh 单端口部署,可跳过 Nginx,直接访问 :8000
|
||
# 使用 Nginx 时建议将 KEFU_SERVE_WEB=false,由 Nginx 托管静态文件
|
||
|
||
upstream kefu_backend {
|
||
server 127.0.0.1:8000;
|
||
keepalive 32;
|
||
}
|
||
|
||
server {
|
||
listen 80;
|
||
server_name your.domain.com;
|
||
|
||
# 前端静态文件(npm run build 产物)
|
||
root /www/wwwroot/douyin/frontend/dist;
|
||
index index.html;
|
||
|
||
# API 转发到 FastAPI
|
||
location /api/ {
|
||
proxy_pass http://kefu_backend;
|
||
proxy_http_version 1.1;
|
||
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;
|
||
proxy_read_timeout 300s;
|
||
}
|
||
|
||
# Swagger 文档(可选)
|
||
location ~ ^/(docs|redoc|openapi.json)$ {
|
||
proxy_pass http://kefu_backend;
|
||
proxy_set_header Host $host;
|
||
}
|
||
|
||
# SPA(hash 路由只需返回 index.html)
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
}
|