官方:https://github.com/fatedier/frp
systemd 管理 frp 实践
1.如Linux服务端上没有安装 systemd,可以使用 yum 或 apt 等命令安装 systemd
----------------------------------------------------------------------------------------
# yum
yum install systemd
# apt
apt install systemd
----------------------------------------------------------------------------------------
2.使用文本编辑器,如 vim 创建并编辑 frps.service 文件。
------------------------------------------------------------
vi /etc/systemd/system/frps.service
------------------------------------------------------------
3.写入内容:
------------------------------------------------------------
[Unit]
# 服务名称,可自定义
Description = frp server
After = network.target syslog.target
Wants = network.target
[Service]
Type = simple
# 启动frps的命令,需修改为您的frps的安装路径
ExecStart = /opt/software/frp/frps -c /opt/software/frp/frps.toml
[Install]
WantedBy = multi-user.target
-----------------------------------------------------------
4.使用 systemd 命令,管理 frps。
------------------------------------------------------------
# 启动frp
systemctl start frps
# 停止frp
systemctl stop frps
# 重启frp
systemctl restart frps
# 查看frp状态
systemctl status frps
# 配置 frps 开机自启
systemctl enable frps
# 禁止开机启动
systemctl disable frps
----------------------------------------------------------
5.配置 frpc的开启启动也类似,服务名改为/etc/systemd/system/frpc.service,启动命令修改为 frpc的即可。
---------------------------------------------------------------
[Unit]
# 服务名称,可自定义
Description = frp client
After = network.target syslog.target
Wants = network.target
[Service]
Type = simple
# 启动frpc的命令,需修改为您的frpc的安装路径
ExecStart = /opt/software/frp/frpc -c /opt/software/frp/frpc.toml
[Install]
WantedBy = multi-user.target
----------------------------------------------------------------