Ngrok how to share localhost to world

Often there is a need to open your computer for access via the Internet, for all comers or with a password. For example, if you want to demonstrate a new code, publish files, or simply record all network traffic for research purposes.

To do this, you need to install a web server and direct traffic to it through a third-party server via the reverse SSH tunnel using a program like LocalTunnel or ProxyLocal.

$ gem install localtunnel
$ localtunnel -k ~/.ssh/id_rsa.pub 8080

After that, your computer will be accessible from an address like http://8bv2.localtunnel.com. We launch the program – and localhost online.

$ localtunnel 8080

Recently, a new free service has appeared that does the same thing, but works more stable and has more functionality. Therefore, it is probably worthy of mention: ngrok.com.

The program is distributed in binaries for Linux, Mac OS X, and Windows and works immediately “out of the box” even without registration. But if you register, then there are a couple of additional features.

1. Using SSL:

curl https://myapp.ngrok.com

2. Password protection:

ngrok -httpauth "user:password" 8080

3. Subdomains to choose from, reserved for the future:

ngrok -subdomain myapp 8080

4. Tunnel TCP and UDP:

ngrok -proto tcp 8080
Related Post