Access localhost from another computer through the Internet

In my recent post I have described how to access localhost from another computer connected to the same LAN. Now I am going to show you how you can make your localhost accessible throughout the entire Internet.

To make your localhost accessible throughout the internet you have to take care of various things like allow traffic for port 80 through your system, port forwarding the etc and its quite tedious to properly configure these things.

Therefore I found a straight forward way to make my localhost accessible throughout the internet. So let’s get started:

For Windows:

1. First go-to this URL https://ngrok.com/download

2. Download the “ngrok” for your operating system.

3. Extract “ngrok.exe” to wherever you want. Let’s say we are extracting it to “c:\ngrok”

4. Now right click on this-pc and go to properties

5. Click on “Advance system settings” in the right pane.

6. Click on “Environment Variables” in “Advanced” tab.

7. You will see a list of variables and values. Double Click on “Path”

8. Click on New button and enter the path where you have extracted the “ngrok.exe”. In our case it is c:\ngrok.

Note: Don’t include file name (ngrok.exe). You are just required to write the path to the folder where you have extracted the ngrok.exe

9.Save everything and open command prompt and type ngrok and hit enter. If you get error message that says “ngrok is not recognized as an internal or external command …” . Then you have to restart your computer.

10. Now you must know the port on which your localhost is running. It is the number that you write after colon symbol while opening your localhost in the browser.

11. Now use this command to start using ngrok

ngrok http <your_port_number>

12. You will see output message to open a link in your browser. You can use this link to open your localhost throughout the internet.

For Ubuntu:

1. First go-to this URL https://ngrok.com/download

2. Download the ngrok for your operating system.

3. Extract ngrok to /bin folder. (you will require root access)

4. make this file executable

5. now use this command to start using ngrok

ngrok http <port_number>

replace <port_number> with the port number where your localhost is running.

6. You will see output message to open a link in your browser. You can use this link to open your localhost throughout the internet.

Leave a Reply

Your email address will not be published.