Adventures in Web Development.

Using Localtunnel to Share Your Localhost to the Rest of the World

In this tutorial I’m going to show you how to install and use a tool called localtunnel
to make your localhost accessible to the rest of the world.

Localtunnel is a ruby gem so you will need ruby in order to install it.
You can go to rubyinstaller.org to downlad an installer for ruby.
Just install just like how you install most of the programs(click next a couple of times until you reach finish).

Make sure that you can use ruby from the command line by executing the following command in the command line(terminal)

1

ruby --version

After that you can install ruby gems. You can go to the rubygems download page
and follow the instructions on how to install it. Basically you’re going to download a zip or tgz file then extract it
somewhere then execute the following command on the folder where you have extracted the files:

1

ruby setup.rb

Then go to the localtunnel site and follow the instructions there. It’s
quite simple all you have to do is execute the following command:

1

gem install localtunnel

After it has installed open up a new command line and change the directory to where your public ssh key is
then execute the following command: localtunnel id_rsa.pub 80

The id_rsa.pub is the filename of your public ssh key. You can easily determine your public ssh key by its
file extension(.pub).

If you don’t have a public ssh key go to help.github.com
and follow the guide on how to generate a new key.

Apache is normally running at port 80 but if you have modified where its running and you’re not sure what port it
is then look for the httpd.conf file(Google what its called for Linux or Mac, not really sure).
Then search for: Listen

If you’re running Nginx, IIS or something else. Then Google it because I have no experience running those servers yet and I
can’t really tell what port do they normally run.

If you see a 2 to 4 digit number beside it then that’s the port where Apache is running.
That is what you will use for the localtunnel command. So for example you found Listen 8020
then your localtunnel command will be localtunnel 8020

After that it will prompt you to type in your passphrase, the one that you typed when you generated your public ssh key.

After that you will see something like this:

1

Port 8020 is now publicly accessible from http://8bv2.localtunnel.com ...