ngrok入门

久闻 ngrok 的大名,但一直没有使用过,今天恰好在本地虚拟机调试一个应用,需要开放公网访问,遂简单记录一下。

一、ngrok 是什么

ngrok 是一个全球分布的反向代理,在任何云或私人网络或你的机器上运行,为你的网络服务提供前台。简单来说就是把无公网 IP 机器上运行的服务通过 ngrok 开放到公网,也称 “打洞” 内网穿透NAT穿透 等。其他比较常见的应用如 向日葵 TeamViewer

ngrok is a globally distributed reverse proxy fronting your web servicesrunning in any cloud or private network, or your machine


二、安装

  1. 注册账号(官网

  1. 下载客户端wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz
  2. 解压tar xzf ngrok-v3-stable-linux-amd64.tgz

三、基本使用

  1. 配置 token./ngrok config add-authtoken your_token
  2. 启动./ngrok help./ngrok http 80
  3. 运行面板

 


四、总结

  1. 开箱即用,基本够用;由于无国内节点,经常断线重连,建议临时使用
  2. 免费套餐资源限制严格,如果有带公网 IP 的服务器,推荐使用 Nps https://github.com/fatedier/frp
  3. 如果打算生产使用,可以升级套餐,也可以看看类似的 Cloudflare Tunnel

五、参考

https://ngrok.com/pricing

https://github.com/fatedier/frp

https://www.cloudflare.com/zh-cn/products/tunnel/


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *