在较新的 Linux 系统中一经采用 Systemd 作为系统服务管理工具,以下为服务端作为服务方式运行的方式
首先在下面路径建立一个frps.service文件,以centos7为例
#编写frps.service文件 vi/etc/systemd/system/frps.service #将下面的代码复制进去 [Unit] Description=frps After=network.target [Service] TimeoutStartSec=30 ExecStart=/root/frp/frps-c/root/frp/frps.ini ExecStop=/bin/kill$MAINPID [Install] WantedBy=multi-user.target
如果你的运行命令不是/root/frp/frps -c /root/frp/frps.ini,需要对service文件进行修改,将文件的 ExecStart 改为你的运行命令,更改完成后需要输入
systemctl daemon-reload
管理命令
开机启动:systemctlenablefrps 取消开机启动:systemctldisablefrps 启动:systemctlstartfrps 重新启动:systemctlrestartfrps 停止运行:systemctlstopfrps 查看运行状态:systemctlstatusfrps
frpc客户端配置方法差不多,只需将上文所有frps替换成frpc就是frpc客户端教程了