ai-chatbot/FRPC穿透配置说明.md
Your Name 53ddb7e585
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
Initial commit - clean repository
2025-12-17 20:15:18 +08:00

154 lines
3.1 KiB
Markdown
Raw Permalink 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.

# FRPC 穿透配置说明
## 配置信息
### 穿透配置已成功添加
**配置名称**: `ai-chatbot`
**配置详情**:
- **本地地址**: `127.0.0.1:3001` (已修改,避免与3000端口冲突)
- **远程端口**: `5245`
- **穿透类型**: TCP
- **状态**: ✅ 已启动成功
### 访问方式
**通过穿透访问**:
- **穿透地址**: `156.225.27.52:5245`
- **访问URL**: `http://156.225.27.52:5245`
**直接访问**(如果服务器开放80端口):
- **直接地址**: `http://156.225.27.52`
### 配置位置
- **配置文件**: `/etc/frp/frpc.ini`
- **备份文件**: `/etc/frp/frpc.ini.backup`
- **服务状态**: `systemctl status frpc.service`
## 当前配置内容
```ini
[ai-chatbot]
name = ai-chatbot
type = tcp
local_ip = 127.0.0.1
local_port = 3001
remote_port = 5245
```
**注意**: 应用端口已从3000改为3001,因为3000端口被其他服务占用。
## 验证穿透
### 检查FRPC服务状态
```bash
# 查看服务状态
systemctl status frpc.service
# 查看日志
journalctl -u frpc.service -n 50 | grep ai-chatbot
# 查看所有代理状态
journalctl -u frpc.service -n 100 | grep "start proxy success"
```
### 测试连接
```bash
# 测试本地端口
curl http://localhost:3000
# 测试穿透端口(从外网)
curl http://156.225.27.52:5245
```
## 注意事项
1. **端口冲突**: 如果3000端口被其他服务占用,需要:
- 修改应用监听端口
- 或修改FRPC配置中的 `local_port`
2. **防火墙**: 确保FRP服务器端(156.225.27.52)开放了5245端口
3. **应用状态**: 确保应用正常运行在3000端口:
```bash
pm2 status ai-chatbot
pm2 logs ai-chatbot
```
## 修改配置
如果需要修改穿透配置:
```bash
# 1. 编辑配置文件
nano /etc/frp/frpc.ini
# 2. 修改配置后重启服务
systemctl restart frpc.service
# 3. 检查状态
systemctl status frpc.service
```
## 常用命令
```bash
# 查看FRPC配置
cat /etc/frp/frpc.ini
# 重启FRPC服务
systemctl restart frpc.service
# 查看FRPC日志
journalctl -u frpc.service -f
# 查看所有穿透代理
journalctl -u frpc.service | grep "start proxy success"
```
## 故障排查
### 如果穿透不工作
1. **检查应用是否运行**:
```bash
pm2 status ai-chatbot
```
2. **检查端口监听**:
```bash
ss -tlnp | grep 3000
```
3. **检查FRPC日志**:
```bash
journalctl -u frpc.service -n 50
```
4. **检查FRPC配置**:
```bash
/usr/local/bin/frpc -c /etc/frp/frpc.ini -L /tmp/frpc.log
```
5. **检查FRP服务器端端口**:
- 确保FRP服务器(156.225.27.52)的7000端口正常
- 确保远程端口5245未被占用
## 其他穿透配置
当前服务器还有其他穿透配置:
- `http044`: SSH (5204)
- `bt-panel`: 宝塔面板 (5205)
- `ai-classification`: AI分类系统 (5206)
- `performance-api`: 性能API (5234)
- `qwen-api`: Qwen API (5236)
- `weipinghui-parser`: 微品汇解析器 (5238)
- `shebeiguanli-frontend`: 设备管理前端 (5243)
- `shebeiguanli-backend`: 设备管理后端 (5244)
- `ai-chatbot`: AI聊天机器人 (5245) ✅ 新增