How to Access Localhost from Anywhere using Any Device

How to access localhost from anywhere using any device.

How to Access Localhost from Anywhere

How many times, you have been working on an application (or an app) and you have designed and completed your application nicely. You have set up everything very nicely on your local system. Now you want to show this work to your client, who is sitting on a remote location.  Also, you want to test this application on a different device ( such as mobile, tablets etc). To do these things, either you have to host your application on a public server, or you can use any service which allows to access localhost from anywhere.

To make this task easy and smooth,  I am going to discuss one popular service called ngrok.

How to Setup LAMP

 htaccess Tutorial

What is ngrok

ngrok provides a service through which you can securely expose a local web server to the internet and capture all traffic for detailed inspection and replay. It means ngrok provides a publicly accessible URL.

Using the publicly accessible URL given by ngrok, you can expose your localhost to anyone. Internally, ngrok creates a tunnel to a port on your local machine.

The Advantage of using ngrok services is that you can focus on development without any deployment.

How to Setup ngrok

1. Go to a download page. I am using Ubuntu. So, I have downloaded Linux 64 bit version. You can download as per your operating system.

2. Unzip the downloaded folder. Unzip using a terminal command.

Linux commands with examples

In my case, my downloaded folder is in /var/www directory.

3. I am running my PHP application on port 8000. My current localhost URL is http://localhost:8000 . To access my localhost for anywhere, I have to point the same port on ngrok as well.

Start with PHP built-in webserver

Once your command is successfully executed, you get the following output.

create tunnel through ngrok.
using this URL http://4211e1da.ngrok.com. I can access my localhost from anywhere. When you run ngrok in your system, you get different forwarding URL.

You can inspect traffic, through this URL 127.0.0.1:4040. It opens a dashboard, where you see inbound requests.
Monitor traffic
Apart from that, ngrok provides signup and paid features which includes,

1. Custom Subdomains

2. TCP Tunneling

3. Password Protection

4. Multiple Simultaneous Tunnels

5. Tunnel your own domains

6. Reserved Subdomains

Tagged , , , . Bookmark the permalink.

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.