Mac内网穿透

本地机上有个网站,想让外网的人访问测试,又不想部署到外面服务上,开始想到使用“花生壳”,结果不支持Mac系统。

ngrok

下载:https://ngrok.com/download

文档:https://ngrok.com/docs

找到一个据说能做内网穿透的软件,虽然看起来是国外的,不用自己服务的话,可能会慢啊,先试试吧!

下载解压到指定目录,执行如下:

Chaim:tools Chaim$ ./ngrok 
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 '.
    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 http https://localhost     # expose a local https server
    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.3.29

AUTHOR:
  inconshreveable - 

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

实际执行如下:

Chaim:tools Chaim$ ./ngrok http 127.0.0.1:3000

ngrok by @inconshreveable                                                                (Ctrl+C to quit)
                                                                                                         
Session Status                online                                                                     
Session Expires               7 hours, 59 minutes                                                        
Version                       2.3.29                                                                     
Region                        United States (us)                                                         
Web Interface                 http://127.0.0.1:4040                                                      
Forwarding                    http://fd6562ef.ngrok.io -> http://127.0.0.1:3000                          
Forwarding                    https://fd6562ef.ngrok.io -> http://127.0.0.1:3000                         
                                                                                                         
Connections                   ttl     opn     rt1     rt5     p50     p90                                
                              0       0       0.00    0.00    0.00    0.00                               

在浏览器里访问“http://fd6562ef.ngrok.io” 就可以访问本地“http://127.0.0.1:3000” 了,不过的确很慢!这个域名每次启动都会变,临时用下还好,免费的能要求啥呢!

参考

https://blog.csdn.net/u011886447/article/details/73268407

你可能感兴趣的:(Mac内网穿透)