- Download ngrok for your favorite OS.
- Unzip and, if you want, add it to your path (Move it to
/usr/local/bin
or use your favorite command)
$ unzip /path/to/ngrok.zip
- Remember, you need to add
ngrok
to your path or use./path/to/ngrok
$ ngrok help
$ ngrok http 8080
Then, you can see the ngrok UI in your terminal, for example:
ngrok by @inconshreveable
Tunnel Status online
Version 2.2.8
Web Interface http://127.0.0.1:4040
Forwarding http://92832de0.ngrok.io -> localhost:8080
Forwarding
https://92832de0.ngrok.io -> localhost:8080
Connnections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
In this example, you can access to your service (localhost:8080)
through
https://92832de0.ngrok.io
Sure, https it’s hot to go!
Now, you can access to your localhost
from anywhere, including the International Space Station (ISS).
Awesome, right?
You just need include the host-header flag:
$ ngrok http -host-header=myservice.local.vh port
For example, if I wanna expose this virtual host: f1soft.local.vh:80
$ ngrok http -host-header=jotarios.local.vh 80