How to Make your localhost Online on Ubuntu?

I was working on a personal project with my friends. It is hosted on a virtual machine running under Ubuntu Xenial Xerus. And we reached the point where we should access it from other computers which are not in the same LAN in order to test it. I tried first to access it from the host which is running under macOS Sierra. However, I faced many problems with VirtualBox and bridged network since I am connected to a complex network infrastructure. It is not like the default configurations, so I succeeded just in make in visible to the host only which is useless in my case.

Then, I tried to access it from its external IP. It worked, but I needed to configure the router to allow NAT. This step was impossible for me because I did not have the necessary credentials.

I read about this issue, and I found an elegant solution.  I found two tools that allow exposing a local server behind a NAT or firewall to the internet. I will talk about the interesting and unlimited one in this post.

This tool is called ngrok. You can download it from here:  In order to configure it follow these steps:

Step 1: Unzip the downloaded file.

Step 2: run the following command on your terminal ./ngrok help for documentation.

Step 3: run the following command on your terminal: ./ngrok http 80 to make http://localhost:80 accessible online. You can change the port depending on where your application is listening. Check if the firewall is allowing traffic on this specific port.

Step 4: You will see a link in the following form * in your terminal. This is the link that you can share with your friend to access your localhost. It will be like the following figure:


You can also check the request and the connected devices to your localhost from the link: http://localhost:4040.

P.S: This steps were tested on Ubuntu Xenial Xerus running on VirtualBox.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a website or blog at

Up ↑

%d bloggers like this: