GitHub:https://github.com/fatedier/frp
#服务器端
cd /usr/local
wget https://github.com/fatedier/frp/releases/download/v0.34.3/frp_0.34.3_linux_amd64.tar.gz
tar -zxvf frp_0.34.3_linux_amd64.tar.gz
#编辑 frps.ini 文件
[common]
bind_port = 7000
token = ****** #字母或数字
vhost_http_port = 8080
vhost_https_port = 443
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin
log_file = /usr/local/frp/frps.log
log_level = info
log_max_days = 3
subdomain_host = XXX.XX #客户端使用子域名时,则添加此项
#运行命令
./frps -c ./frps.ini
#设置自动启动
vi /lib/systemd/system/frps.service
#写入以下配置
[Unit]
Description=frps service
After=network.target network-online.target syslog.target
Wants=network.target network-online.target
[Service]
Type=simple
#启动服务的命令(frps的实际安装目录)
ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.ini
[Install]
WantedBy=multi-user.target
#查询服务是否开机启动
systemctl is-enabled servicename.service
#开机自启
systemctl enable frps
#取消开机自启
systemctl disable frps
#启动frp
systemctl start frps
#重启
systemctl restart frps
#重新加载
systemctl reload frps
#停止
systemctl stop frps
#查看状态
systemctl status frps
#显示启动失败的服务
systemctl --failed