Files
vf_react/nginx-agentchat-config.conf
2025-11-22 08:57:37 +08:00

55 lines
1.9 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.

# Nginx 配置片段 - 添加到 valuefrontier.conf 的 HTTPS server 块中
# 将这些配置添加到 443 端口的 server 块中,在其他 location 配置之前
# ============================================
# AI Chat 应用 (Next.js)
# ============================================
# AgentChat 应用代理 - 使用新路径避免与现有 /chat/ 冲突
location /ai-chat {
# 重写路径,去掉 /ai-chat 前缀
rewrite ^/ai-chat(.*)$ $1 break;
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 传递重要Session 共享)
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;
}
# Next.js 静态资源
location ~ ^/ai-chat/(_next|__nextjs) {
rewrite ^/ai-chat(.*)$ $1 break;
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;
# 静态资源缓存
expires 1y;
add_header Cache-Control "public, immutable";
}
# MCP API 已经配置在 /mcp/ 路径 (保持不变)
# location /mcp/ { ... } # 已存在,无需修改