mac 上ngrok 实现内网穿透

2019-08-03  本文已影响0人  侬姝沁儿

一、准备工作

前往https://ngrok.com/,下载ngrok ,然后注册一个账号,并获取官方分配一个授权令牌。

# mac
brew install ngrok

二、本地绑定授权令牌

打开https://dashboard.ngrok.com/auth,复制你的授权令牌,执行如下操作:

ngrok authtoken 授权令牌

三、内网穿透

ngrok http 80 # 80是你跑的内网端口,例如你使用python3 -m http.server跑起的8000端口服务

注意:此操作需要翻墙

结果如下:

ngrok by @inconshreveable

Tunnel Status                 online
Version                       2.0/2.0
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://92832de0.ngrok.io -> localhost:80
Forwarding                    https://92832de0.ngrok.io -> localhost:80

Connnections                  ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00

更多用法:https://ngrok.com/docs

http://XXX.ngrok.io 这个类型的地址便是访问的外部地址,这个是变的,每次重启服务时都会重新生成。

上一篇 下一篇

猜你喜欢

热点阅读