背景提要
操作系統 Ubuntu, 目的是讓我的 frp 后台啟動不妨礙我干其他事,同時能自啟動,畢竟服務器那邊常常維護重啟啥的。
步驟
-
登錄服務器,輸入
sudo vim /lib/systemd/system/frps.service
其實就是在 root/lib/systemd/system 下面新建一個文件frps.service
-
在文件里面寫入以下內容
[Unit]
Description=frps daemon
[Service]
Type=simple
#此處把/root/frp_linux_arm64替換成 你的frps的實際安裝目錄
ExecStart=/root/frp_linux_arm64/frps -c /root/frp_linux_arm64/frps.ini
[Install]
WantedBy=multi-user.target
你的安裝目錄可以這樣得到,到你安裝 frps 的目錄下 輸入pwd
- 然后就啟動frps
sudo systemctl start frps
- 再打開自啟動
sudo systemctl enable frps
搞定收工
其他
- 重啟應用
sudo systemctl restart frps
- 停止應用
sudo systemctl stop frps
- 查看日志
sudo systemctl status frps
參考文獻
https://github.com/fatedier/frp/issues/176
https://gist.github.com/ihipop/4dc607caef7c874209521b10d18e35af