Localtunnel – Make Your Local Server Accessible Online

Localtunnel - Make Your Local Server Accessible Online

Let us say you have just created a beautiful website on your local development system. The client wants to see your work. What will you do? You can either host the website online, so the client can view it. Or, screenshot each page of your website and send them to your client. Would you do that? Not necessarily! Meet Localtunnel that allows you to easily share a web service on your local development machine without putting it online or without messing with DNS and firewall settings. It assigns you an unique publicly accessible url that will proxy all requests to your locally running webserver. To put this in simple terms, you can expose your local development system to real world. In this brief tutorial, I will show you how to make your local server accessible online using Localtunnel in Unix-like systems.

Localtunnel – Make Your Local Server Accessible Online

Install Localtunnel

To install Localtunnel on your local development system, you need NodeJS installed on your system. Refer the following link to install NodeJS on Linux systems.

Once NodeJS installed, run the following command to install Localtunnel:

sudo npm install -g localtunnel

Usage

To make your local system accessible from everywhere (assuming your local system is running on port 80), run the following command from your terminal:

lt --port 80

Sample output would be:

your url is: https://gczjxjqvuc.localtunnel.me

localtunnel1

That’s it. It will connect to the tunnel server, setup the tunnel, and assign you an unique URL to use for your testing. This URL will remain active for the duration of your session; so feel free to share it with others for testing your webservice or just sharing your work. You can restart your local server if necessary. Localtunnel is smart enough to detect this and reconnect once it is back.

Here is how I access my local Ubuntu server from online.

localtunnel2

You may find it difficult to remember the URL. To make it much easier to remember, use subdomain (If it is available) as shown below.

$ lt --port 80 --subdomain myubuntu
your url is: https://myubuntu.localtunnel.me

Now, I can access my local Ubuntu system from anywhere using URL: https://myubuntu.localtunnel.me.

localtunnel3

To check Localtunnel version, run:

$ lt --version
 1.8.3

To get help:

$ lt --help
Usage: /usr/local/bin/lt --port [num] <options>

Options:
 -h, --host Upstream server providing forwarding
 [default: "http://localtunnel.me"]
 -s, --subdomain Request this subdomain
 -l, --local-host Tunnel traffic to this host instead of localhost, override
 Host header to this host
 -o, --open opens url in your browser
 -p, --port Internal http server port [required]
 --help Show this help and exit [boolean]
 --version Show version number [boolean]

Hope this helps. We will be posting useful guides every day. If you think our guides are helpful, please share them on your social, professional networks and support OSTechNix.

Cheers!

Resource:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You may also like...