Exposing Localhost Server over Internet Using ngrok and VS Code
Last Updated :
07 Aug, 2020
We setup and build many projects but before moving them to the production server, we always test the project, and we share the project among our team to share the progress, we share our project code on GitHub as it supports version control system and, but what if we do not want to share the code, but we only need to share the outcome to the client, preferably we consider localhost to show the outcome of the project to the client, for big or ongoing projects there will be more than a client if clients are at different locations we use the screen share option in a video call to show the working.
But the drawback of screen share is, the client only sees the working demo, not the actual hands-on experience. To overcome this issue we have a tool called ‘ngrok’ to globally share the projects which are available on localhost.
Using ngrok tool we get a unique URL to share our project globally for free of cost(with some limitations).
Installation and Working of ngrok Tool
1. Go to ngrok.com
2. SignUP & Download ngrok software from the Setup and Installation section of the website.

Dashboard image after signing in
3. Download the software package as per your Operating System. ngrok software will be downloaded in a zip format, after downloading ngrok software extract the files to the desired location and name the extracted folder as ngrok.
4. Open Visual Studio Code application.
5. Create or Open your project
6. Now, install live server extension on VS Code editor and click on “Go Live” button on the bottom bar

Install “Live Server” extension from Extensions: Marketplace in the editor itself

Go Live for running the project on localhost server
7. After clicking on Go Live, project will be hosted on the local host server.
Deploying the Project over the Internet
1. Now open a new terminal on VS Code or use the shortcut key ctrl+shift+` .
2. Enter the following commands :
cd <location_to_ngrok_folder>
ngrok authtoken <your_auth_token>
3. Replace <location_to_ngrok_folder> with the address of your ngrok extracted folder and <your_auth_token> with the authentication token which is present on the ngrok dashboard or from here.
Executing the above commands will return the following output.

After giving line 1, next line is generated automatically
4. Enter the following command to expose localhost over Internet
ngrok.exe http 5500
Note: 5500 is the port number, give your port number accordingly
The above command will display the output similar to the following

Here:
- Web Interface link is to get the statistics of the shared URL
- Forwarding url’s with ngrok domain name are the actual links to share the localhost project
5. To stop the url from surfing online press ctrl+c key combination on the terminal .
Note: To set password to url, we must login to ngrok and connect our ngrok account using auth key.
Type this command in the terminal of the code editor:
ngrok http -auth="<username>:<password>" 5500
Replace <username> with your respective username and <password> with your respective password and 5500 with the respective port.
Similar Reads
How to Install and Setup Live Server Extensions on Visual Studio code?
Visual Studio Code is one of the most sought-after IDE (Integrated Development Interface) of the current time. It helps the developers to efficiently write, build and test software over a single platform by combining and providing a multilateral set of functions. Visual Studio Code supports various
3 min read
How to Share Files On Local Network Using Apache File Server?
Normally we share files between our computers and mobiles using Gmail, Whatsapp, Bluetooth, etc. But here we are going to discuss sharing files using Apache Server from your computer. Your system has to be connected to a LAN for Accessing the files from one computer to another connected on a LAN. Th
2 min read
Setup Web Server Over Docker Container in Linux
Before setting up a server we must know the real meaning or definition of a server. So, the Server is a program that provides the client with any kind of services. For example, a web server provides our websites, a database server provides us data. This means every server has work to do and for ever
2 min read
How to Change or Hide the Nginx Server Signature?
In Linux, changing or hiding the Nginx server signature consists of modifying the server tokens that are sent in the HTTP response headers. The server signature has information about the server software and its version, which can be a security perspective risk. In this article, we will see how we ca
5 min read
How to Access Localhost on Mobile Browsers?
Accessing localhost on a mobile browser is a useful skill for developers who need to test and debug their web applications on different devices. Whether you're developing a responsive website or a mobile app, being able to view localhost from your smartphone can significantly streamline your testing
3 min read
How to Deploy Angular Application to Firebase using GitHub ?
Many of us unable to showcase our small-scale or personal projects over the web. Since hosting these projects are a bit difficult and also costs a few bucks sometimes. In this article, we will show you how to deploy your Angular application at no cost without buying any domain or hosting provider. A
3 min read
Install Visual Studio Code in Kali Linux
Visual Studio Code is an open-source, cross-platform source-code editor developed by Microsoft. It is used by developers for developing software and writing code using programming languages such as C, C++, Python, Go, Java, etc. Visual Studio Code employs the same editor used in Azure, DevOps Featu
2 min read
How to Install and Configure Nginx from Source on Linux
Nginx is written in C language by Igor Sysoev to overcome the C10K problem (i.e. Concurrently handling 10k(ten thousand) connections). The problem was how to optimize the network socket to handle numerous clients at the same time. Nginx is a solution to that problem. It is a free and open-source sof
4 min read
How to Set Up Apache Web Server in AWS EC2 Linux (Ubuntu) Instance?
In this article, we will look into the process of setting up Apache Web Server in AWS EC2 Linux Instance.This tutorial has been done on a system running Windows 10 Home (Version 20H2). Implementation:The steps taken to complete this tutorial are being stated below: Step 1: Go to portal.aws.amazon.co
4 min read
Hosting Your Django Website on a CentOS VPS
Hosting any website/web application on a live server can sometimes become difficult if proper steps are not taken while deploying it. There are mainly 3 different types of hosting: Shared Hosting - Usually used for small (single page) websites with limited traffic.VPS Hosting - VPS ( Virtual Private
5 min read