44 lines
1.3 KiB
Bash
44 lines
1.3 KiB
Bash
#!/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" |