背景

之前的内网穿透是使用的lanproxy,这个项目已经停止更新了,而且使用的是java语言开发的,占用内存要大一些,本就低的服务器配置就更加吃紧了,遂切换到frps

下载

在github上下载自己系统合适的版本:https://github.com/fatedier/frp/releases

安装

修改 frps.toml

# 绑定服务的端口号
bindPort = 7000
auth.method="token"
auth.token="your token"

创建 frps.service 文件

sudo vim /etc/systemd/system/frps.service

写入内容

[Unit]
# 服务名称,可自定义
Description = frp server
After = network.target syslog.target
Wants = network.target

[Service]
Type = simple
# 启动frps的命令,需修改为您的frps的安装路径
ExecStart = /path/to/frps -c /path/to/frps.toml

[Install]
WantedBy = multi-user.target

使用 systemd 命令管理 frps 服务

# 启动frp
sudo systemctl start frps
# 停止frp
sudo systemctl stop frps
# 重启frp
sudo systemctl restart frps
# 查看frp状态
sudo systemctl status frps

设置 frps 开机自启动

sudo systemctl enable frps

客户端使用

这里我使用的是 https://github.com/luckjiawei/frpc-desktop 这个项目,图形化客户端,配置比较方便,去这里下载合适的版本

多用户鉴权

下载:https://github.com/gofrp/fp-multiuser

根据说明文档增加用户

修改frps.toml

bindPort = 7000
auth.method="token"
# 把原来的auth.token删除

[[httpPlugins]]
addr = "127.0.0.1:7200"
path = "/handler"
ops = ["Login"]