安装frps
下载frps,记得从 https://github.com/fatedier/frp/releases 下载_linux_amd64.tar.gz 类型的才适合Ubuntu
wget https://github.com/fatedier/frp/releases/download/v0.52.3/frp_0.52.3_linux_amd64.tar.gz
tar zxvf frp_0.52.3_linux_amd64.tar.gz
cd frp_0.52.3_linux_amd64/
配置frps
我的配置大概为
bindAddr = "0.0.0.0"
bindPort = 7000
kcpBindPort = 7000
vhostHTTPPort = 80
vhostHTTPSPort = 443
webServer.addr = "127.0.0.1"
webServer.port = 7500
webServer.user = "admin"
webServer.password = "admin"
log.to = "./frps.log"
log.level = "info"
log.maxDays = 3
auth.method = "token"
auth.token ="123456"
配置详情可以参考
frps.toml中文全注释版本
放行frps端口
包括不限于系统版本的端口,阿里云等安全组的端口,比如你用宝塔面板也需要放行一下
添加frps自启动
创建配置文件
sudo vim /etc/systemd/system/frps.service
文件内容为
[Unit]
Description = frps_service
After = network.target syslog.target
Wants = network.target
[Service]
Type = simple
User = root
ExecStart = /home/kimi/frps/frps -c /home/kimi/frps/frps.toml
[Install]
WantedBy=multi-user.target
设置frps服务开机自启:
sudo systemctl enable frps
启动frps服务:
sudo systemctl start frps
常用frps控制指令:
sudo systemctl start frps # 启动frp服务
sudo systemctl stop frps # 停止frp服务
sudo systemctl restart frps # 重启frp服务
sudo systemctl status frps # 查看frp服务状态