89 lines
2.0 KiB
Markdown
89 lines
2.0 KiB
Markdown
# 访问测试结果
|
||
|
||
## 当前状态
|
||
|
||
### ✅ 应用运行正常
|
||
- **本地访问**: `http://localhost:3001` ✅ 正常
|
||
- **应用状态**: PM2 显示 online
|
||
- **端口监听**: 3001 端口已监听
|
||
|
||
### ⚠️ FRPC 穿透问题
|
||
|
||
**问题**: 外部无法通过 `http://156.225.27.52:5245` 访问
|
||
|
||
**可能原因**:
|
||
1. FRP 服务器端未开放 5245 端口
|
||
2. FRPC 配置中的 local_ip 或 local_port 不正确
|
||
3. 防火墙阻止了连接
|
||
|
||
## 解决方案
|
||
|
||
### 方案 1: 检查 FRP 服务器配置
|
||
|
||
需要在 FRP 服务器端(156.225.27.52)检查:
|
||
- 是否开放了 5245 端口
|
||
- FRP 服务器配置是否正确
|
||
|
||
### 方案 2: 使用 Nginx 反向代理(推荐)
|
||
|
||
如果 FRPC 穿透有问题,可以使用 Nginx 直接代理:
|
||
|
||
```bash
|
||
# 在服务器上配置 Nginx
|
||
cat > /etc/nginx/sites-available/ai-chatbot << 'EOF'
|
||
server {
|
||
listen 80;
|
||
server_name 156.225.27.52;
|
||
|
||
location / {
|
||
proxy_pass http://localhost:3001;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection 'upgrade';
|
||
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_cache_bypass $http_upgrade;
|
||
}
|
||
}
|
||
EOF
|
||
|
||
ln -sf /etc/nginx/sites-available/ai-chatbot /etc/nginx/sites-enabled/
|
||
nginx -t && systemctl restart nginx
|
||
```
|
||
|
||
然后通过 `http://156.225.27.52` 访问。
|
||
|
||
### 方案 3: 检查防火墙
|
||
|
||
```bash
|
||
# 检查防火墙规则
|
||
ufw status
|
||
iptables -L -n | grep 5245
|
||
|
||
# 如果需要,开放端口
|
||
ufw allow 5245/tcp
|
||
```
|
||
|
||
## 测试命令
|
||
|
||
```bash
|
||
# 测试本地访问
|
||
curl http://localhost:3001
|
||
|
||
# 测试穿透访问(从外网)
|
||
curl http://156.225.27.52:5245
|
||
|
||
# 检查FRPC日志
|
||
journalctl -u frpc.service -f | grep ai-chatbot
|
||
```
|
||
|
||
## 当前配置
|
||
|
||
- **应用端口**: 3001
|
||
- **FRPC本地端口**: 3001
|
||
- **FRPC远程端口**: 5245
|
||
- **FRPC配置**: `/etc/frp/frpc.ini`
|
||
|