分类
技术

frp 开机自启

系统为 CentOS 7。以下示例为服务端 frps,客户端 frpc 同理。

$ vi /usr/lib/systemd/system/frps.service

输入内容如下:

其中,/root/frp/frps 是程序自身,/root/frp/frps_full.ini 是配置文件,自行更改。

[Unit]
Description=frps
After=network.target

[Service]
ExecStart=/root/frp/frps -c /root/frp/frps_full.ini
ExecStop=/bin/kill -s QUIT $MAINPID  
Restart=always
RestartSec=1min

[Install]
WantedBy=multi-user.target

设置开机自启,并启动:

$ systemctl enable frps
$ systemctl start frps

相见恨晚,比 ngrok 方便多了。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注