Docker运行frp

没想到按照网上教程安装frps这么费劲(很多下载的Docker镜像与镜像内的配置文件目录不一致),还是自己顺理下:

服务端配置

服务器环境:CentOS Linux 7 

下载frps 镜像

 docker pull snowdreamtech/frps

配置服务端配置文件

#没有文件夹可创建

[root@VM-20-2-centos ~]# cd /etc/frp/
[root@VM-20-2-centos frp]# ls
frps.toml
[root@VM-20-2-centos frp]# vi frps.toml 

[common]
# 监听端口
bind_port = 7000
# 面板端口
dashboard_port = 7500
# 登录面板账号设置
dashboard_user = admin
# 登录面板的密码
dashboard_pwd = 123456
# 对user开放的web访问端口

vhost_http_port = 7010

subdomain_host = frps.tpxtyc.com
# 身份验证
token = zUBOt3GqQEinL

启动服务端容器

sudo docker run -d   --name frps   -p 7000:7000   -p 7500:7500  -p 7010:7010 -v /etc/frp/frps.toml:/etc/frp/frps.toml   --restart=always   snowdreamtech/frps

客户端配置

下载Docker镜像

pull snowdreamtech/frpc

 配置客户端文件

[root@localhost frp]# vi /etc/frp/frpc.toml 
[common]
server_addr = 服务端ip

server_port = 7000
token = zUBOt3GqQEinL


[web1]
type = http
local_ip = 127.0.0.1
local_port = 8091
subdomain  = cdzf

启动客户端Docker容器

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

本次使用frp是为了将内容web服务在外网也能访问。使用的http协议,如果有其他需要可按照官方网站内容进行配置。https://gofrp.org/zh-cn/docs/

其他配置

域名解析:

*.frp.test.com 到服务器ip

宝塔配置:

 网站配置:

cdz.frps.test.com(必须保留一个主域名)

 *.frps.test.com

url反向代理 

中增加http://127.0.0.1:7010(对应frp的配置)

完成以上配置后,客户端启动后,便可通过cdzf.frps.test.com 访问内容的服务了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值