Remote url for localhost server

Remote url for localhost server

There is a nice tool called ngrok. It allows to bind the URL for your localhost server!

For example, you've launched a django development server on you computer:

python manage.py runserver

and this project can be accessed by remote URL.

What for?

At least i can imagine such tasks:

  • demonstrate project to customer
  • check your site integration with payment system. For example paypal, where for receiving IPN messages you need a working site URL, even for sandbox

How

  • Download ngrok from here
  • Unpack downloaded archive
  • Start django development server (by default on 8000 port)
  • Start ngrok:

    ./ngrok 8000
    
  • In console you'll see something like this:

    ngrok
    
    Tunnel Status                 online
    Version                       1.6/1.6
    Forwarding                    http://51c85c8a.ngrok.com -> 127.0.0.1:8000
    Forwarding                    https://51c85c8a.ngrok.com -> 127.0.0.1:8000
    Web Interface                 127.0.0.1:4040
    # Conn                        0
    Avg Conn Time                 0.00ms
    

Now your server is bind to http://51c85c8a.ngrok.com

Improvements

It is not very useful, that on every start ngrok will generate new url like ********.ngrok.com.

But we can assign custom subdomain and project can be accessed by the same url.

To do it we need:

  • register
  • take auth token
  • let ngrok know your auth token (it is needed to do only once):

    ./ngrok -authtoken your_auth_token 8000
    
  • set your custom subdomain like this:

    ./ngrok  -subdomain=mysupersite 8000
    

After that our local server will be shown at http://mysupersite.ngrok.com

Published: May 9, 2014
Bookmark and Share
Comments powered by Disqus