ubuntu20.04 frps 开机自动启动

 GitHub - fatedier/frp: A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet. - GitHub - fatedier/frp: A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.https://github.com/fatedier/frp/上面是下载网址


# 编写 frp service 文件,以 ubuntu 为例
vim /usr/lib/systemd/system/frps.service (有时候需要手动创建system文件夹)
# 内容如下,注意我放在/home/ubuntu/下面,放哪里看个人。另外这里面不能用~这种转义符号,一定要写绝对路径,因为不同用户登录会转到不同用户下,会产生歧义。

以前我写成,死活不会执行

ExecStart=~/frps -c ~/frps.ini

下面的正确的写法,要写成绝对路径 

[Unit]
Description=frps
After=network.target

[Service]
TimeoutStartSec=30
ExecStart=/home/ubuntu/frps -c /home/ubuntu/frps.ini
ExecStop=/bin/kill $MAINPID

[Install]
WantedBy=multi-user.target

 
 启动 frp 并设置开机启动

systemctl enable frps
systemctl start frps
systemctl status frps

 
# 部分服务器上,可能需要加 .service 后缀来操作,即:

systemctl enable frps.service
systemctl start frps.service
systemctl status frps.service 

frps 或 frpc 启动无效时,可以尝试先停止服务 

systemctl stop frpc

Guess you like

Origin blog.csdn.net/babytiger/article/details/121274534