准备

  • 域名解析 将frp.xx.com解析到服务器ip,将泛域名 *.frp.xx.com解析到frp.xx.com即可
  • https证书申请 泛域名证书现在可以用acme.sh申请Let's Encrypt证书,坑挖好了 ,看这里 [新手教程]申请https泛域名解析
  • GitHub下载最新编译文件 GitHub frp releases
  • 复制frps和frps.ini文件到frps目录下
frps
--frps
--frps.ini
--Dockerfile
  • 修改frps.ini配置文件

只需要按需修改

name value rmk
vhost_http_port 8888 http端口
vhost_https_port 445 https端口
dashboard_user username web管理端管理员账户
dashboard_pwd password web管理端管理员密码
subdomain_host frp.xx.com 子域名配置
# [common] is integral section
[common]
# A literal address or host name for IPv6 must be enclosed
# in square brackets, as in "[::1]:80", "[ipv6-host]:http" or "[ipv6-host%zone]:80"
bind_addr = 0.0.0.0
bind_port = 7000 # udp port to help make udp hole to penetrate nat
bind_udp_port = 7001 # udp port used for kcp protocol, it can be same with 'bind_port'
# if not set, kcp is disabled in frps
kcp_bind_port = 7000 # specify which address proxy will listen for, default value is same with bind_addr
# proxy_bind_addr = 127.0.0.1 # if you want to support virtual host, you must set the http port for listening (optional)
# Note: http port and https port can be same with bind_port
vhost_http_port = 8888
vhost_https_port = 445 # response header timeout(seconds) for vhost http server, default is 60s
# vhost_http_timeout = 60 # set dashboard_addr and dashboard_port to view dashboard of frps
# dashboard_addr's default value is same with bind_addr
# dashboard is available only if dashboard_port is set
dashboard_addr = 0.0.0.0
dashboard_port = 7500 # dashboard user and passwd for basic auth protect, if not set, both default value is admin
dashboard_user = user
dashboard_pwd = 124356aabb # dashboard assets directory(only for debug mode)
# assets_dir = ./static
# console or real logFile path like ./frps.log
log_file = /frps/frps.log # trace, debug, info, warn, error
log_level = info log_max_days = 3 # disable log colors when log_file is console, default is false
disable_log_color = false # auth token
token = tokenwords # heartbeat configure, it's not recommended to modify the default value
# the default value of heartbeat_timeout is 90
# heartbeat_timeout = 90 # only allow frpc to bind ports you list, if you set nothing, there won't be any limit
allow_ports = 2000-3000,3001,3003,4000-50000 # pool_count in each proxy will change to max_pool_count if they exceed the maximum value
max_pool_count = 5 # max ports can be used for each client, default value is 0 means no limit
max_ports_per_client = 0 # if subdomain_host is not empty, you can set subdomain when type is http or https in frpc's configure file
# when subdomain is test, the host used by routing is test.frps.com
subdomain_host = frp.xx.com # if tcp stream multiplexing is used, default is true
tcp_mux = true # custom 404 page for HTTP requests
# custom_404_page = /path/to/404.html
  • 修改Dockerfile文件
FROM centos
WORKDIR /frp
COPY . .
RUN chmod -R 777 /frp
CMD ["/frp/frps","-c","/frp/frps.ini"]
  • 创建镜像

    frps目录下执行
docker build -t frps .
  • 创建并启动容器
docker run -d --restart=always -v /etc/frp/frps.ini:/frp/frps.ini -p 7000:7000 -p 7500:7500 -p 8888:8888 -p 445:445 --name frps_server frps

注意

445端口在win下为保留端口,请换到1000以上端口,具体参考msdn的文档说明

测试

访问IP:8888查看是否正常,若有异常可用 docker log 容器id 进行查看错误日志后处理

扩展

看的比较仔细的小伙伴已经看到了,我们端口设置的是8888,并不是80.访问的时候需要带上端口,使用上并不方便,下面我们将配置nginx转发,实现域名访问.

点这里继续 docker nginx 自定义配置容器

docker frps 内网穿透容器化服务的更多相关文章

  1. 四、frp内网穿透服务端frps.ini各配置参数详解

    [必须]标识头[common]是不可或缺的部分 [必须]服务器IPbind_addr = 0.0.0.00.0.0.0为服务器全局所有IP可用,假如你的服务器有多个IP则可以这样做,或者填写为指定其中 ...

  2. frp 内网穿透访问内网Web服务

    ps:最近想要通过域名(公网)访问或者测试在本地搭建的 web 服务(不想在公网IP服务器上再部署个服务,也不想通过teamview等工具远程卡到爆!), 由于本地机器没有公网 IP,无法将域名解析到 ...

  3. 【代理】内网穿透工具 frp&frps

    frp 是一个高性能的反向代理应用,可以帮助您轻松地进行内网穿透,对外网提供服务,支持 tcp, http, https 等协议类型,并且 web 服务支持根据域名进行路由转发. ### frp 的作 ...

  4. 基于frp的内网穿透实例4-为本地的web服务实现HTTPS访问

    原文地址:https://wuter.cn/1932.html/ 一.想要实现的功能 目前已经实现将本地的web服务暴露到公网,现想要实现https访问.(前提:已经有相应的证书文件,如果没有就去申请 ...

  5. linux之frp服务部署(内网穿透)

    frp服务部署(内网穿透) 目的 更快的进行内网穿透调试以及云端开发测试 服务器为CentOS 7,客户端为win11 frp介绍 frp 是一个开源项目, 采用 C/S 模式,将服务端部署在具有公网 ...

  6. windows(Linux)创建”内网穿透“工具(通过自定义域名访问部署于内网的 web 服务,可以用于调试微信支付,支付宝支付,微信公众号等开发项目)

    此方法需要自有服务器和域名,如果没有这些的开发者, 可以参考钉钉提供的内网穿透方式:https://www.cnblogs.com/pxblog/p/13862376.html 一.准备工作 1.域名 ...

  7. frp + nginx 配置多人共用的http 内网穿透服务

    来源:简书   https://www.jianshu.com/p/c9d7527d607b 一. 前言 frp 是一个用Go语言开发的,可用于内网穿透的高性能的反向代理应用,支持 tcp, udp ...

  8. 内网穿透神器(ngrok)服务端部署【分享一台自己的ngrok服务器】【多平台】

    Ngrok为何物 “ngrok 是一个反向代理,通过在公共的端点和本地运行的 Web 服务器之间建立一个安全的通道.ngrok 可捕获和分析所有通道上的流量,便于后期分析和重放.”这是百度百科上给Ng ...

  9. 手写内网穿透服务端客户端(NAT穿透)原理及实现

    Hello,I'm Shendi. 这天心血来潮,决定做一个内网穿透的软件. 用过花生壳等软件的就知道内网穿透是个啥,干嘛用的了. 我们如果有服务器(比如tomcat),实际上我们在电脑上开启了服务器 ...

随机推荐

  1. Gif开发笔记(一):gif介绍、编译和工程模板

      前言   实现gif图片的解码和生成.   Gif 简介   GIF格式的名称是Graphics Interchange Format的缩写,是在1987年由Compu Serve公司为了填补跨平 ...

  2. 6、Sping Cloud Feign

    1.Spring Cloud Feign简介 (1).Fegin简介 官方文档:http://projects.spring.io/spring-cloud/spring-cloud.html#spr ...

  3. 半夜删你代码队 Day5冲刺

    一.每日站立式会议 1.站立式会议 成员 昨日完成工作 今日计划工作 遇到的困难 陈惠霖 跟进作业 完成注册界面 相关界面设计内容知识不充足 侯晓龙 开始双人合作 开始与数据库结合 无 周楚池 初步完 ...

  4. 【Home Page】本博客使用指南

    [关于] 坐标:ZJ.HZ.XJ. 高一现役 OIer,经常被吊打. Luogu:_Wallace_ [近期] 浙大 ICPC-ACM 2020 部分题解: 关键字「ZJU-ICPC Summer T ...

  5. Filebeat+Logstash自定义多索引

    方案一:推荐 [root@elk-node-1 filebeat]# cat filebeat.yml|egrep -v "^$|^#|#" filebeat.inputs: - ...

  6. 测试web-view,实现小程序和网页之间的切换

    官方有句提醒:个人类型与海外类型的小程序暂不支持使用 测试条件: 1.小程序后台管理中,进入"开发设置",设置一个业务域名(注意:不是设置服务器域名).比如 https://tes ...

  7. Java-静态关键字Static&静态代码块

    静态成员变量:(static修饰变量) 如果一个成员变量使用了static关键字,那么这个变量不再属于对象自己,而是属于所在的类.多个对象共享同一份数据. 静态方法:(static修饰方法) 一旦使用 ...

  8. 四、LoadRunner11安装和破解

    之前安装了LoadRunner12 社区版的,应为满足不了工作需求, 上网仔细查了教程下来LoadRunner11破解版 链接:https://pan.baidu.com/s/1dM8Lwf4p160 ...

  9. adb devices查看不到Android模拟器的设备

    1.先开启模拟器,后执行adb devices命令: List of devices attached 2.找到SDK的安装目录下platform-tools文件夹下adb.exe文件,将其复制到桌面 ...

  10. AWT04-AWT常用组件

    1.基本组件 方法名 说明 Button 按钮 Canvas 用于绘画的画布 Checkbox 复选框组件 CheckboxGroup 用于将多个Checkbox合成一组,一组Checkbox只有一个 ...