客户端操作
客户端创建 frpc.service
vim /lib/systemd/system/frpc.service也可以去路径 /lib/systemd/system/ 创建 frps.service
服务端创建 frps.service
vim /lib/systemd/system/frps.service也可以去路径 /lib/systemd/system/ 创建 frpc.service
客户端填入以下内容
[Unit]
#服务描述
Description=frpc service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
#执行命令
ExecStart=/root/frp/frpc -c /root/frp/frpc.ini
[Install]
WantedBy=multi-user.target注意 ExecStart=/root/frp/frpc -c /root/frp/frpc.ini 修改成自己frp的路径
!!!此处直接运行 systemctl 命令会提示需要重载!!!
于是终端里输入
systemctl daemon-reload使用 systemctl 命令来控制客户端frpc
启动
sudo systemctl start frpc关闭
sudo systemctl stop frpc重启
sudo systemctl restart frpc查看状态
sudo systemctl status frpc设置开机自动启动
sudo systemctl enable frpc服务端操作
服务端填入以下内容
[Unit]
#服务描述
Description=frps service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
#执行命令
ExecStart=/root/frp/frps -c /root/frp/frps.ini
[Install]
WantedBy=multi-user.target注意 ExecStart=/root/frp/frps -c /root/frp/frps.ini 修改成自己frp的路径
!!!此处直接运行 systemctl 命令会提示需要重载!!!
于是终端里输入
systemctl daemon-reload使用 systemctl 命令来控制服务端frps
启动
sudo systemctl start frps关闭
sudo systemctl stop frps重启
sudo systemctl restart frps 查看状态
sudo systemctl status frps设置开机自动启动
sudo systemctl enable frps
linux下FRP常用命令
后台运行frp
定位至frp文件所在位置
服务端:
nohup ./frps -c frps.ini >/dev/null 2>&1 &客户端:
nohup ./frpc -c frpc.ini >/dev/null 2>&1 &查看frp进程
ps -aux|grep frp| grep -v grep结束frp进程
#kill -9 12345(找到的进程号)