自建内网穿透服务器-基于Docker的FRP内网穿透部署

14324472932024-04-03linux运维52

创建配置文件

# 创建存放目录
sudo mkdir /etc/frp
# 创建frps.ini文件
vim /etc/frp/frps.toml
frps.toml文件配置内容
[common]
# 监听端口
bind_port = 7000
# 面板端口
dashboard_port = 7500
# 登录面板账号设置
dashboard_user = admin
dashboard_pwd = 19940922
# 设置http及https协议下代理端口(非重要)
vhost_http_port = 7080
vhost_https_port = 7081


# 身份验证
token = 19940922
#服务器镜像:snowdreamtech/frps

#重启:always
#网络模式:host

#文件映射:/etc/frp/frps.toml:/etc/frp/frps.toml


docker run --restart=always --network host -d -v /etc/frp/:/etc/frp/ --name frps snowdreamtech/frps


服务器镜像:snowdreamtech/frpc

重启:always

网络模式:host

文件映射:/路径/frp/:/etc/frp/

docker run --restart=always --network host -d -v /etc/frp/:/etc/frp/ --name frpc snowdreamtech/frpc


配置文件示例



[common]
# server_addr为FRPS服务器IP地址
server_addr = 服务器地址
# server_port为服务端监听端口,bind_port
server_port = 7000
# 身份验证
token = token密码

# [ssh] 为服务名称,下方此处设置为,访问frp服务段的2288端口时,等同于通过中转服务器访问127.0.0.1的22端口。
# type 为连接的类型,此处为tcp
# local_ip 为中转客户端实际访问的IP 
# local_port 为目标端口
# remote_port 为远程端口

#[ssh]
#type = tcp
#local_ip = 192.168.1.229
#local_port = 80
#remote_port = 18022

[nashttps web]
type = tcp
local_ip = 192.168.2.245
local_port = 5001
remote_port = 18080

[nashttp web]
type = tcp
local_ip = 192.168.2.245
local_port = 8000
remote_port = 18081


发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。