You really want to try this if you all of a sudden have a localhost website to share to others but it’s troublesome to get onto the same network and lookup IP and stuff.
To install ngrok, just run the following. More details here.
[code] brew cask install ngrok [/code]
Then have your localhost running. Here is a sample command to share your local directory. You can pick any port number. Let’s pick 8080 for example.
[code] ruby -run -e httpd . -p 8080 [/code]
Then involve ngrok
[code] ngrok http 8080 [/code]
You will see something like this
[code] ngrok by @inconshreveable
Session Status online Session Expires 7 hours, 59 minutes Version 2.3.35 Region United States (us) Web Interface http://127.0.0.1:4040 Forwarding http://abc123ef.ngrok.io -> http://localhost:8080 Forwarding https://abc123ef.ngrok.io -> http://localhost:8080
Connections ttl opn rt1 rt5 p50 p90 2 1 0.02 0.01 0.23 0.45
HTTP Requests ---———-
GET /favicon.ico 404 Not Found GET / 200 OK [/code]
A publicly available URL, actually two, are created: https:// abc123ef.ngrok.io The abc123ef part will be different each time you involve ngrok. Now just send this URL to others and they will be able to access your localhost website.
You can also examine the incoming traffic at http:// 127.0.0.1:4040
Stopping ngrok is as easy as Ctrl-C.