update pay function
This commit is contained in:
91
update-nginx-complete.sh
Normal file
91
update-nginx-complete.sh
Normal file
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "========================================="
|
||||
echo "完整的 Nginx 配置更新"
|
||||
echo "========================================="
|
||||
|
||||
# 备份当前配置
|
||||
echo "[1] 备份当前配置..."
|
||||
sudo cp /etc/nginx/sites-available/valuefrontier /etc/nginx/sites-available/valuefrontier.bak.$(date +%Y%m%d_%H%M%S)
|
||||
|
||||
echo ""
|
||||
echo "[2] 请编辑 Nginx 配置文件:"
|
||||
echo "sudo nano /etc/nginx/sites-available/valuefrontier"
|
||||
echo ""
|
||||
echo "在 HTTPS server 块中(约第 228 行,location /chat/ 之前)添加:"
|
||||
echo ""
|
||||
cat << 'NGINX_CONFIG'
|
||||
# ============================================
|
||||
# AI Chat 应用 (Next.js) - MCP 集成
|
||||
# ============================================
|
||||
|
||||
# AI Chat 主应用
|
||||
location /ai-chat {
|
||||
proxy_pass http://127.0.0.1:3000/ai-chat;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
# 保持原始 Host 和协议
|
||||
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 https;
|
||||
proxy_set_header X-Forwarded-Port 443;
|
||||
|
||||
# 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;
|
||||
chunked_transfer_encoding on;
|
||||
|
||||
# 超时设置
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_read_timeout 300s;
|
||||
}
|
||||
|
||||
# Next.js 静态资源
|
||||
location ~ ^/ai-chat/(_next|_vercel|__nextjs) {
|
||||
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 https;
|
||||
|
||||
# 静态资源缓存
|
||||
expires 365d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# AI Chat 的 API 调用(如果需要)
|
||||
location ~ ^/ai-chat/(api|mcp) {
|
||||
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 https;
|
||||
proxy_set_header Cookie $http_cookie;
|
||||
proxy_buffering off;
|
||||
}
|
||||
|
||||
NGINX_CONFIG
|
||||
|
||||
echo ""
|
||||
echo "[3] 保存文件后,测试配置:"
|
||||
echo "sudo nginx -t"
|
||||
echo ""
|
||||
echo "[4] 如果测试通过,重载 Nginx:"
|
||||
echo "sudo nginx -s reload"
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "访问地址:"
|
||||
echo "https://valuefrontier.cn/ai-chat"
|
||||
echo "========================================="
|
||||
Reference in New Issue
Block a user