52 lines
1.7 KiB
Nginx Configuration File
52 lines
1.7 KiB
Nginx Configuration File
# 天门 · 魂镜统一入口反向代理(Nginx,可选,profile: nginx)。
|
|
# 对外只暴露 80:/api/* 与 SSE 走后端,其余走前端 Next.js。
|
|
# 启用前需先启动 backend 与 frontend;详见 docker/README.md。
|
|
|
|
upstream hunjing_backend {
|
|
server hunjing-backend:8000;
|
|
keepalive 32;
|
|
}
|
|
|
|
upstream hunjing_frontend {
|
|
server hunjing-frontend:3000;
|
|
keepalive 32;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# 适配人物资料 / 感知文件上传(IMPORT_MAX_FILE_MB 等)。
|
|
client_max_body_size 64m;
|
|
|
|
# ============================== 后端 API 与 SSE 流 ==============================
|
|
location /api/ {
|
|
proxy_pass http://hunjing_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_set_header Connection "";
|
|
|
|
# SSE 必须关闭缓冲,并允许长连接。
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
proxy_read_timeout 86400s;
|
|
proxy_send_timeout 86400s;
|
|
}
|
|
|
|
# ============================== 前端 Next.js ==============================
|
|
location / {
|
|
proxy_pass http://hunjing_frontend;
|
|
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;
|
|
# WebSocket 预留(后续双向实时交互 / Avatar)。
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
}
|