type
status
date
slug
summary
tags
category
icon
password
URL
安装方式
- 下载和安装:
- 首先,你需要到 ngrok 的官方网站(https://ngrok.com/)上下载 ngrok 的客户端。
- 解压下载的文件,并将 ngrok 客户端保存到一个方便访问的位置。
- MAC 上安装
- 获取 Authtoken:
- 在使用 ngrok 之前,你需要注册 ngrok 帐户并获取 Authtoken。这个 Authtoken 是用来验证你的 ngrok 客户端的身份的。
- 在终端中运行以下命令以进行身份验证:
./ngrok authtoken your_auth_token(将your_auth_token替换为你的 Authtoken)。
- 启动 ngrok:
- 打开终端,并导航到保存 ngrok 客户端的目录。
- 运行
./ngrok http port_number命令,其中port_number是你本地服务器运行的端口号。 - 例如,如果你的本地服务器在端口 3000 上运行,你可以运行
./ngrok http 3000。
- 使用 ngrok:
- 运行上述命令后,ngrok 将会生成一个随机的公共 URL,用于访问你的本地服务器。
- 在终端窗口中,你会看到一个类似
Forwarding http://randomstring.ngrok.io -> localhost:3000的消息。这个 ngrok 提供的 URL 就是你的本地服务器的公共访问地址。 - 现在,你可以使用这个 ngrok 提供的 URL 来访问你的本地服务器,以便测试你的 Web 应用程序。

- 作者:凯叔有点卷
- 链接:https://kaishu.i9x.cn//article/ec349ef6-56da-4033-a233-ff3d0aa9e387
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。