首先下载一下对应frp包 https://github.com/fatedier/frp/tags
将下载好的包依次上传至 云服务器(后简称外网服务器) 和 内网服务器
- 上传压缩包后解压
不论外网服务器和内网服务器都上传 下载好的相同的包即可
tar -xzvf 对应的版本.tar.gz
解压后:- 外网服务器配置
因为外网服务器作为中转服务器
所以配置frp文件夹内的 frps.ini
[common]
bind_port = 7003 #配置绑定端口 可自定义
vhost_http_port = 8089 #用于配置web穿透
然后启动 frps
nohup ./frps -c frps.ini >file.out 2>&1 &
- 配置内网服务器
配置frp文件夹内的 frpc.ini
[common]
server_addr = 外网IP 比如 180.xx.xx.xx
server_port = 7003 # 对应外网服务器配置的vhost_http_port
[ssh]
type = tcp
local_ip = 内网IP 比如 192.168.3.102
local_port = 22
#填写frp连接本地ssh的端口 用于ssh远程连接时使用
remote_port = 6000
[web]
type = http # 配置http 或 https
local_ip = 内网IP
local_port = 80 # 需要访问的web服务的端口
custom_domains = 外网IP 比如 180.xx.xx.xx
然后启动 frpc
nohup ./frpc -c frpc.ini >file.out 2>&1 &
-
连接ssh
-
连接web
停止相应的服务
ps -aux|grep frp| grep -v grep
kill -9 对应的进程号