Files
vf_react/check-nginx.sh
2025-11-22 09:16:12 +08:00

44 lines
1.3 KiB
Bash
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.

#!/bin/bash
echo "========================================="
echo "检查 Nginx 配置"
echo "========================================="
# 1. 检查配置文件是否包含 ai-chat 配置
echo "检查 /ai-chat 配置..."
if grep -q "location /ai-chat" /etc/nginx/sites-available/valuefrontier; then
echo "✓ 找到 /ai-chat 配置"
grep -A 10 "location /ai-chat" /etc/nginx/sites-available/valuefrontier
else
echo "✗ 未找到 /ai-chat 配置"
echo ""
echo "请添加以下配置到 /etc/nginx/sites-available/valuefrontier"
echo "(在 location /chat/ 之前添加)"
echo ""
cat << 'EOF'
# AI Chat 应用 (Next.js)
location /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;
proxy_set_header Cookie $http_cookie;
proxy_pass_request_headers on;
proxy_buffering off;
}
EOF
fi
echo ""
echo "测试 Nginx 配置:"
sudo nginx -t
echo ""
echo "如果需要编辑:"
echo "sudo nano /etc/nginx/sites-available/valuefrontier"
echo ""
echo "编辑后重载:"
echo "sudo nginx -s reload"