Exposing your local web server to the Internet
Sometimes, you’re setting up your web server(Apache, Nginx etc) in your local computer. It means your web server is running locally and outside world can’t access to it, other computer in same intranet can access your IP though.
Let’s say, you have developed a web project in your local. You haven’t uploaded projects files and folders to remote hosting server. At that time, your client wanna check the project’s progress at once.
No need to worry in such case. You can immediately setup a localtunnel that can be accessed by outside world with a URL link.
So simple steps you need to do:
Step 1: Download ngrok
Step 2: Unzip it
$ unzip /path/to/ngrok.zip
Step 3: Run it! (in terminal)
$ ./ngrok -help [if you wanna check how does it work]
80 [eg; local web server is running in port
Sample command line output:
Tunnel Status online
Forwarding http://3a4bfceb.ngrok.com -> 127.0.0.1:80
Forwarding https://3a4bfceb.ngrok.com -> 127.0.0.1:80
Web Interface http://127.0.0.1:4040
# Conn 0
Avg Conn Time 0.00ms
Local running web server: http://127.0.0.1:80
Share this URL to client:
Web traffic checking: http://127.0.0.1:4040
[Ref img: from https://ngrok.com/usage]
Requiring passwords to access your tunnels
By default, ngrok tunnels do not require any username or password to access them. This means anyone who knows or guesses the URL or your tunnel can make requests to it. You can secure your tunnels with a username and password by specifying the
-httpauth option when creating your tunnel. This will force HTTP basic authentication on all incoming requests to your tunnels and require that the credentials match those you specify on the command line.
$ ngrok -httpauth="username:12345" 80
If you developer guy wanna quit running instance after checking the developed project by client, you just need to use simple command in terminal: [ Ctrl+C ]
Outside world can not be available to access your shared link:
In next time, you will run ./ngrok 80 in terminal and you will get another shared link: eg; http://xxxxx.ngrok.com. Just send that new link to client or others else you want to send again.