Files
hunjing/docker/nginx/nginx.conf
T

52 lines
1.7 KiB
Nginx Configuration File
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,可选,profile: nginx)。
# 对外只暴露 80:/api/* 与 SSE 经照壁(BFF)走灵台,其余走前端 Next.js。
# 启用前需先启动 backend、bff 与 frontend;详见 docker/README.md。
upstream hunjing_bff {
server hunjing-bff:3000;
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_bff;
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";
}
}