免费试用ngrok

下载Mac版ngrok

Mac OS X 64-Bit

解压

1
$ unzip /path/to/ngrok.zip

运行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$ ./ngrok help
NAME:
ngrok - tunnel local ports to public URLs and inspect traffic

DESCRIPTION:
ngrok exposes local networked services behinds NATs and firewalls to the
public internet over a secure tunnel. Share local websites, build/test
webhook consumers and self-host personal services.
Detailed help for each command is available with 'ngrok help <command>'.
Open http://localhost:4040 for ngrok's web interface to inspect traffic.

EXAMPLES:
ngrok http 80 # secure public URL for port 80 web server
ngrok http -subdomain=baz 8080 # port 8080 available at baz.ngrok.io
ngrok http foo.dev:80 # tunnel to host:port instead of localhost
ngrok tcp 22 # tunnel arbitrary TCP traffic to port 22
ngrok tls -hostname=foo.com 443 # TLS traffic for foo.com to port 443
ngrok start foo bar baz # start tunnels from the configuration file

VERSION:
2.1.18

AUTHOR:
inconshreveable - <alan@ngrok.com>

COMMANDS:
authtoken save authtoken to configuration file
credits prints author and licensing information
http start an HTTP tunnel
start start tunnels by name from the configuration file
tcp start a TCP tunnel
tls start a TLS tunnel
update update ngrok to the latest version
version print the version string
help Shows a list of commands or help for one command

测试80端口

启动本地nginx

1
sudo nginx

访问本地80端口:localhost

执行ngrok http 80

1
$ ngrok http 80

访问http://127.0.0.1:4040

访问临时公网二级域名http://a57407c6.ngrok.io/

http://127.0.0.1:4040查看请求

访问临时公网二级域名https://a57407c6.ngrok.io/

使用自定义域名,需要注册和付费

邵志鹏 wechat
扫一扫上面的二维码关注我的公众号
0%