Subrata Sarkar

Turn your PC into a temporary Web Server with NGROK

Let us imagine a situation where you are developing a website for your client, but do not own a web-server, client is far away from you and is not ready to provide a development server. But you have to show the progress online. How would you tackle this situation?

Well, NGROK is there to save you! In short, it turns your computer into a temporary web-serverby creating a secure tunnel for your localhost port and generating a public URL for you to share with the world. That’s it! Now your client can use that link and look into the site that is in your localhost!

How to setup NGROK

Go to NGROK Official Download page.

Select your operating system and Download NGROK

Mac OS

Install ngrok via brew:

$ brew install ngrok/ngrok/ngrok

OR

Download for Intel (AMD64) | Download for Apple Silicon (ARM64)

Then unzip ngrok from the terminal.

$ sudo unzip /<path-where-zip-file-downloaded>/ngrok-v3-stable-darwin-arm64.zip -d /usr/local/bin

Create a free account, if you don’t have any yet to generate an Auth token. Then run the following command

$ ngrok config add-authtoken <token>

Now start a secured tunnel

$ ngrok http 80

This would create an HTTP and HTTPS forwarding public URLs similar to this for your localhost, which will be accessible by anybody from anywhere as long as your PC is conected to the internet and the tunnel is online.

Linux

There are many different downloads available for Linux distributions. Based on your distribution choose the correct one from the list below and follow the steps.

x86 PCs and Servers: x86-64 | 386
ARM IoT Devices: ARM64 | ARM

Extract the downloaded .zip file

$ sudo tar xvzf /path-to-dowonload/<filename> -C /usr/local/bin

OR Install ngrok via Apt

curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null &&
echo “deb https://ngrok-agent.s3.amazonaws.com buster main” | sudo tee /etc/apt/sources.list.d/ngrok.list &&
sudo apt update && sudo apt install ngrok

OR Install ngrok via Snap

$ snap install ngrok

Add authetication

ngrok config add-authtoken <token>

And finally start a tunnel

$ ngrok http 80

Windows

Install ngrok via Chocolatey.

$ choco install ngrok

OR

64-Bit Download | 32 Bit Download

Extract the .ZIP file. If you already have created an account, run the following command in order to authenticate:

$ ngrok config add-authtoken <token>

Now create the tunnel for your locahost

$ ngrok http 80

To create a free account on ngrok and start sharing, follow this link.

Leave a Reply

Your email address will not be published.