vqp_yw
Last Updated: December 26, 2018
·
9.657K
· poteto

Share localhost with anyone

Ever wanted to quickly share your localhost server with someone else, without going through the hassle of deploying it somewhere?

You’ll be happy to know that there’s a really simple way to do this. First install the localtunnel gem:

$ gem install localtunnel

Next run your localhost server, for example in Rails, using the default WEBrick server:

$ rails s

Or Python:

$ python - m SimpleHTTPServer 8000

The first time you run localtunnel you’ll need to use one of your public SSH keys:

$ localtunnel -k ~/.ssh/id_rsa.pub 8000

You’ll see something like this in your terminal:

➜  project_name git:(develop) localtunnel 8000
   This localtunnel service is brought to you by Twilio.
   Port 8000 is now publicly accessible from http://xxxx.localtunnel.com ...

Now just share http://xxxx.localtunnel.com with whoever needs to see your work.

Subsequently you can just use localtunnel <port> to generate a public URL:

$ localtunnel 8000

And that’s it. Install and setup takes less than 5 minutes, and it works beautifully.

18 Responses
Add your response

6

A very useful tip. Thanks

over 1 year ago ·
59

Useful tool in many scenarios I imagine, but it's worth noting that while using any server that will let you bind to 0.0.0.0 you can simply set up forwarding rules on your router/firewall and anyone outside your network should be able to reach it. WEBrick does this by default.

over 1 year ago ·
846

pagekite.net is even easier

over 1 year ago ·
1451

to get it work don't forget to install this:

sudo apt-get install ruby ruby1.8-dev rubygems1.8 libopenssl-ruby
over 1 year ago ·
1757

Also check out: http://xip.io/ (Created by 37 Signals)

over 1 year ago ·
2472

awesome thx!!

over 1 year ago ·
2731

Very useful!! Thnx :D

over 1 year ago ·
2780

That's nice ! But why python in tags ? all is ruby tools

over 1 year ago ·
3512

Thank you so much.

over 1 year ago ·
3689

Great tip!

over 1 year ago ·
4604

Deff using this.

over 1 year ago ·
4605

@gahtune localtunnel supports python

over 1 year ago ·
5170

Awesome tip! gonna give this a go

over 1 year ago ·
5636

here's another one https://forwardhq.com/

over 1 year ago ·
9051

xip.io only works on a local network

over 1 year ago ·
10022

If you are on the same network you can just take his IP adress and put it on your .htaccess (Allow from xxx.xxx.xxx.xxx)
Then he can go on your IP address and see your loacalhost

over 1 year ago ·
13052

localtunnel github readme: "This project is currently down. Please use Ngrok."

over 1 year ago ·
14784

ngrok is even easier

over 1 year ago ·