下载 frp 到 /opt/frp

1
2
sudo chown -R tojo /opt/frp
sudo chmod -R 755 /opt/frp

1 配置

1.1 客户端

1
vim /opt/frp/frpc.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[common]
server_addr = frp.coder17.com
server_port = 3389

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 60022

[ss-tcp]
type = tcp
local_ip = 127.0.0.1
local_port = 8848
remote_port = 60088

[ss-udp]
type = udp
local_ip = 127.0.0.1
local_port = 8848
remote_port = 60088

1.2 服务端

1
vim /opt/frp/frps.ini
1
2
3
4
5
6
7
8
[common]
bind_port = 3389
vhost_http_port = 60080
vhost_https_port = 60443
subdomain_host = frp.coder17.com
dashboard_port = 60000
dashboard_user = tojo
dashboard_pwd = [email protected]

2 安装为服务

2.1 客户端

1
sudo vim /etc/systemd/system/frpc.service
1
2
3
4
5
6
7
8
9
10
11
12
[Unit]
Description=frp Client Service
After=network.target

[Service]
Type=simple
User=tojo
ExecStart=/opt/frp/frpc -c /opt/frp/frpc.ini

[Install]
WantedBy=multi-user.target

1
2
3
sudo systemctl enable /etc/systemd/system/frpc.service
sudo systemctl start frpc.service
service frpc status

2.2 服务端

1
sudo vim /etc/systemd/system/frps.service
1
2
3
4
5
6
7
8
9
10
11
12
[Unit]
Description=frp Server Service
After=network.target

[Service]
Type=simple
User=tojo
ExecStart=/opt/frp/frps -c /opt/frp/frps.ini

[Install]
WantedBy=multi-user.target

1
2
3
sudo systemctl enable /etc/systemd/system/frps.service
sudo systemctl start frps.service
service frps status