下载地址:https://github.com/fatedier/frp
需求:内网对外暴露端口/服务
frps安装在公网服务器,frpc安装在局域网
服务器frps(server),查看frps.ini,仅监听本机的7000端口
[common]
bind_port = 7000
局域网frpc(client),查看frpc.ini
配置多个ssh,更改[ssh]以及remote_port
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
[ssh2]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6001
[ssh3]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6002
服务器frps(server)添加
[common]
vhost_http_port = 8000
局域网frpc(client),添加web栏
[web]
type = http
local_port = 80
custom_domains = www.tpaer.com
访问www.tpaer.com:8000
修改服务端frps.ini
[common]
# web配置
vhost_http_port = 8000
# frp监听端口
bind_port = 7000
# 验证令牌
token = 52134
# frp管理后台端口
dashboard_port = 7500
# frp管理后台用户名密码
dashboard_user = admin
dashboard_pwd = admin
enable_prometheus = true
# frp日志配置
log_file = /var/log/frps.log
log_level = info
log_max_days = 3
此时访问http://公网ip:7500,会出现如下管理界面
修改frpc.ini
[common]
# 公网ip
server_addr = 124.222.155.84
# 与frps的bind_port一致
server_port = 7000
# 与frps的token一致
token = 52134
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
[web]
type = http
local_ip = 127.0.0.1
local_port = 80
服务器端frps启动
frps -c frps.ini
若后台运行
nohup frps -c frps.ini >/dev/null 2>&1 &
客户端frpc启动
frpc -c frpc.ini
若后台运行
nohup frpc -c frpc.ini >/dev/null 2>&1 &