Have you ever wondered what if our localhost can be turned into a public address and can be accessed by everyone on the internet? Today it is really possible using simple steps, thanks to Ngrok that is very easy to use and very stable. With the help of ngrok, we can simply turn our localhost into public url, even in free plan or no cost at all. This will save you a lot of money if you just want to deploy a website for a testing purpose. You can also make a serious website using this tool if you have a powerful server and planned to make a site using that server.
Making Your Localhost Accessible through the Internet
- First of all, you need to prepare your localhost environment and make sure your site is running well in localhost. Let’s say I have my website running in localhost/mywebsite.
- Let’s download ngrok here.
- Extract the files anywhere in your computer.
- Open Windows Command Prompt (cmd), then point to the folder location of the downloaded ngrok app.
- Inside the folder, type : ngrok.exe http 80
- If successful, you will see something like this :
- Note the forwarding section. Now lets check it out on the browser. In my case, I will type https://d36fa284.ngrok.io/mywebsite.
- Yass, it is so simple to make your localhost accessible through the internet. You can definitely access the url anywhere from the internet. Basically, ngrok has turned your localhost into a public site, in my case it is accessible through https://d36fa284.ngrok.io. You can also check your other sites inside htdocs folder by accessing https://d36fa284.ngrok.io/<any project folders inside htdocs>.
- You can also check the activity log of your site by accessing localhost:4040.
That’s it about how to make your localhost accessible from the internet. For more details about ngrok in order to get more customization, you can check it on ngrok.com/docs. For example, you can set up custom domain, get a stable url all the time, create custom subdomain, and much more.