40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
# 正确的 Nginx 配置 - 添加到 valuefrontier.conf 的 HTTPS server 块中
|
||
# 在 location /chat/ 之前添加
|
||
|
||
# ============================================
|
||
# AI Chat 应用 (Next.js) - MCP 集成
|
||
# ============================================
|
||
|
||
# 处理 /ai-chat -> /ai-chat/ 重定向
|
||
location = /ai-chat {
|
||
return 301 /ai-chat/;
|
||
}
|
||
|
||
# 主应用代理
|
||
location /ai-chat/ {
|
||
# 关键:proxy_pass 结尾的 / 会去掉 /ai-chat/ 前缀
|
||
proxy_pass http://127.0.0.1:3000/;
|
||
|
||
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;
|
||
|
||
# Cookie 和认证
|
||
proxy_set_header Cookie $http_cookie;
|
||
proxy_pass_request_headers on;
|
||
|
||
# WebSocket 支持
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection "upgrade";
|
||
|
||
# 性能优化
|
||
proxy_buffering off;
|
||
proxy_cache off;
|
||
|
||
# 超时设置
|
||
proxy_connect_timeout 60s;
|
||
proxy_send_timeout 300s;
|
||
proxy_read_timeout 300s;
|
||
} |