设置自启

vim /lib/systemd/system/frps.service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[Unit]
Description=Frp Server Service
After=network.target

[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/home/lighthouse/frp_0.36.0_linux_amd64 -c /home/lighthouse/frp_0.36.0_linux_amd64/frps.ini

[Install]
WantedBy=multi-user.target

-- 插入 --

sudo systemctl enable frps
sudo systemctl start frps

1
2
3
4
5
[root@VM-4-13-centos system]# sudo systemctl enable frps
Created symlink from /etc/systemd/system/multi-user.target.wants/frps.service to /usr/lib/systemd/system/frps.service.
[root@VM-4-13-centos system]# sudo systemctl start frps
[root@VM-4-13-centos system]#

/home/lighthouse/frp_0.36.0_linux_amd64/frps -c /home/lighthouse/frp_0.36.0_linux_amd64/frps.ini

参考 https://www.cnblogs.com/3hhh/p/12535454.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[common]  
server_addr = 1.116.129.124
server_port = 7000
tls_enable = true
authentication_method = token
token = ganxy2003

[ssh]
type = tcp
local_ip = 192.168.0.102
local_port = 22
remote_port = 2222

[web]
type = http
local_ip = 192.168.0.102
local_port = 5000
custom_domains = 1.116.129.124
vhost_http_port = 7001

[web_dav]
type = tcp
local_ip = 192.168.0.102
local_port = 5005
remote_port = 5005 #tls_enable = true

heartbeat_interval = 30
heartbeat_timeout = 90

测试
[common]
server_addr = 1.116.129.124
server_port = 7000

[ssh]
type = tcp
local_ip = 192.168.0.102
local_port = 22
remote_port = 2222

[dsm]
type = tcp
local_ip = 192.168.0.102
local_port = 5001
remote_port = 443

[ds_file]
type = tcp
local_ip = 192.168.0.102
local_port = 5001
remote_port =5001

[http_webdav]
type = tcp
local_ip = 192.168.0.102
local_port = 5005
remote_port = 5005

[emby]
type = tcp
local_ip = 192.168.0.102
local_port = 8097
remote_port = 8096

heartbeat_interval = 30
heartbeat_timeout = 90