Ngrokn内网穿透
官网介绍
点击进入官网地址。
百度词条说:ngrok 是一个反向代理,通过在公共的端点和本地运行的 Web 服务器之间建立一个安全的通道。ngrok 可捕获和分析所有通道上的流量,便于后期分析和重放.
其实说白了就是一句户:将本地主机作为服务器,通过内网穿透技术让外网访问本机上面的项目和文件。
- 官网的示例
操作
- 非常简单,在window系统Win+R键然后回车打开命令行执行下面的命令。
ngrok http 80
就是将80端口的地址映射出去。如果你想要开放其他端口比如说3000,把80改成3000即可。官网的原文如下所说:
- 1 Expose a local web server to the internet
- 2 ngrok allows you to expose a web server running on your local machine to the internet. Just tell ngrok what port your web server is listening on.
- 3 If you don’t know what port your web server is listening on, it’s probably port 80, the default for HTTP.
- 4 When you start ngrok, it will display a UI in your terminal with the public URL of your tunnel and other status and metrics information about connections made over your tunnel.
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
访问
浏览器直接打开 http://92832de0.ngrok.io。如果部署的项目在Tomcat或者Apache等web服务器上,打开之后在链接之后加上相应的访问地址就可以访问到项目。