工具下载
https://github.com/fatedier/frp/releases
官方文档
https://gofrp.org/zh-cn/docs/
公网服务器配置
修改配置文件:frps.ini
1 2 3
| [common] bind_port = 7088 vhost_http_port = 8088
|
服务启动
1
| nohup ./frps -c frps.ini &
|
内网机器配置
修改配置文件:frpc.ini
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| [common]
server_addr = xx.xx.xx.xx
server_port = 7088
[ssh] type = tcp
local_ip = 192.168.3.2
local_port = 22
remote_port = 2022
[web] type = http
local_port = 8001 custom_domains = xxx.guyouda.cn
|
启动命令
1
| nohup ./frpc -c frpc.ini &
|
Ubuntu开机自启动
sudo vim /etc/rc.local
1 2 3 4 5 6 7 8 9 10
| #!/bin/bash
nohup /home/youda/softwares/frp/frpc -c /home/youda/softwares/frp/frpc.ini >/dev/null 2>&1 & sudo chmod +x /etc/rc.local sudo ln -fs /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service sudo vim /lib/systemd/system/rc-local.service
[Install] WantedBy=multi-user.target Alias=rc-local.service
|