必要条件
需要有固定IP的外网服务器
下载
# 最新版下载地址
https://github.com/fatedier/frp/releases
# Ubuntu 服务器下载文件
https://github.com/fatedier/frp/releases/download/v0.44.0/frp_0.44.0_linux_amd64.tar.gz
# Windows
https://github.com/fatedier/frp/releases/download/v0.44.0/frp_0.44.0_windows_amd64.zip
服务器-安装
下载文件
wget https://github.com/fatedier/frp/releases/download/v0.44.0/frp_0.44.0_linux_amd64.tar.gz
解压文件
tar zxvf frp_0.44.0_linux_amd64.tar.gz
进入到文件目录
cd frp_0.44.0_linux_amd64
编辑服务器配置文件
vim frps.ini
编辑内容:
[common]
bind_port = 7000
vhost_http_port = 8000
服务器-启动服务
# 测试启动
./frps -c ./frps.ini
# 后台启动
nohup ./frps -c ./frps.ini > logs.out 2>1 &
# 查询启动任务ID
ps -ef | grep frps
# 杀死进程
kill -9 进程ID
客户端-Win11-安装
使用 Windows 客户端连接
- 解压window 客户端 frp_0.44.0_windows_amd64.zip
- 修改配置文件 frpc.ini
[common]
# 服务器地址
server_addr = xxx.xxx.xxx.xxx
# 服务器端口
server_port = 7000
[web01]
# 服务类型
type = http
# 本机IP
local_ip = 127.0.0.1
# 本机端口
local_port = 8000
# 访问地址可以配置域名, 也可以配置IP, 配置域名. 需要域名IP指向服务器. 配置IP则和服务器IP相同
custom_domains = xxx.xxx.xxx.xxx
常用配置
服务器配置 frps.ini
[common]
bind_port = 7000
vhost_http_port = 8000
客户端配置 frpc.ini
# 服务类型
type = http
# 本机IP
local_ip = 127.0.0.1
# 本机端口
local_port = 8000
# 访问地址可以配置域名, 也可以配置IP, 配置域名. 需要域名IP指向服务器. 配置IP则和服务器IP相同
custom_domains = xxx.xxx.xxx.xxx