Have you ever wanted to share a website you're developing on your local machine with someone else? Or perhaps you need to demo a project to a client or a colleague without deploying it to a public server? This is where LocalTunnel
comes to the rescue. In this guide, we'll walk through the steps of using LocalTunnel
to expose your locally hosted website to the internet, making it accessible to anyone, anywhere
What is LocalTunnel?
LocalTunnel
is a powerful tool that allows you to expose your local development server to the internet. It creates a secure tunnel to a public URL, enabling others to access your locally hosted website as if it were live on the web.
Let's Setup
Install nodejs and npm in your system
For Windows and mac OS
nodejs.org-
For Linux
-
Ubuntu/debian
sudo apt update sudo apt install nodejs npm
-
Arch linux
sudo pacman -S nodejs npm
-
Install local tunnel
Open your terminal and run the following command to install localtunnel globally
npm install -g localtunnel
Start your Local Server
start your application or website on local development server
Use localtunnel
In your Terminal , run the following command
lt --port <your_local_port>
For example
if website or application is hosted on local host i.e port 3000
lt --port 3000
LocalTunnel will generate a unique URL which you can share with others to access your locally hosted website
Some advance options
Custom Subdomain
lt --port <your_local_port> --subdomain <your_custom_subdomain>
Allowing specific hostnames
lt --port <your_local_port> --host <allowed_hostname>
Setting Maximum Connections
lt --port <your_local_port> --max-conn 3
Specifying Base Domain
lt --port <your_local_port> --domain <your_domain>
💡 Be mindful when using LocalTunnel, as it's convenient but may pose security risks. Avoid exposing sensitive information, and make certain your local server is secure, preventing any inadvertent exposure of confidential data to the public.
Top comments (1)
thanks