Locatunnel is a free and open source software to expose local web server on the Internet. The way in which localtunnel is designed so you can deploy web application from your home computer without public static IP address or firewall configuration.
Installation
Localtunnel client is written in node.js
and can be easily installed using npm
- Install
npm
from repository - Install localtunnel using npm
- Deploy web application locally on non privileged ephemeral ports. (Example Port 5000)
- Expose webserver using localtunnel
sudo apt update
sudo apt install npm
sudo npm install -g localtunnel
lt --port 5000
With above command you might get following error for node binaries.
localtunnel /usr/bin/env: ‘node’: No such file or directory.
This error occurs because ubuntu does not have symlink for node
from nodejs
. Use following command to create symlink and run command again.
ln -s /usr/bin/nodejs /usr/bin/node
Once localtunnel is successfully installed you would get publicly accessible subdomain url and your web application would go live. You can also get subdomain of your own choice by providing -s
flag following by subdomain name in localtunnel command line options.
By default Ubuntu installation would create localtunnel binary at /usr/local/bin/lt
. You can find it's node module at /usr/local/lib/node_modules/localtunnel
to check client code.
Conclusion
Localtunnel is very useful if you want to quickly share your web site or web application on the Internet from home. However by no mean it's full fledged deployment option also keeping application always up is challenging.