LocalTunnel Server Setup Documentation
Source: Dev.to

1. Files
1.1 docker-compose.yml
version: "3.8"
services:
lt-server:
image: defunctzombie/localtunnel-server:latest
container_name: lt-server
restart: always
ports:
- "3000:3000"
networks:
- localtunnel-net
command: bin/server --port 3000 --host 0.0.0.0
localtunnel-nginx:
image: nginx:latest
container_name: localtunnel-nginx
depends_on:
- lt-server
restart: always
ports:
- "8081:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./site.conf:/etc/nginx/conf.d/default.conf:ro
networks:
- localtunnel-net
networks:
localtunnel-net:
driver: bridge
1.2 nginx.conf
events {
worker_connections 1024;
}
http {
include /etc/nginx/conf.d/*.conf;
}
1.3 site.conf
server {
listen 80;
location / {
proxy_pass http://lt-server:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
1.4 Running LocalTunnel Client Command
nohup npx localtunnel --port 3000 --host http://34.68.37.115:8081 > tunnel.log 2>&1 &
- This runs LocalTunnel in the background and logs output to
tunnel.log.
Example log output
nohup: ignoring input
your url is: http://angry-liger-20.34.68.37.115
2. Installation
2.1 Prerequisites
- Docker & Docker Compose installed.
- Node.js and
npxinstalled (for running the LocalTunnel client).
2.2 Steps
-
Clone or copy the configuration files into a directory:
mkdir ~/localtunnel cd ~/localtunnel # Add docker-compose.yml, nginx.conf, site.conf -
Start the LocalTunnel server and Nginx reverse proxy:
docker-compose up -dlt-serverlistens internally on port3000.localtunnel-nginxexposes port8081externally.
-
Verify containers are running:
docker ps
3. Usage
3.1 Start LocalTunnel Client
nohup npx localtunnel --port 3000 --host http://:8081 > tunnel.log 2>&1 &
- Replace “ with your public server IP or domain.
tunnel.logstores the output, including your public URL.
Example
your url is: http://angry-liger-20.34.68.37.115
3.2 Check Logs
cat tunnel.log
- Confirms that the tunnel is running and shows the public URL.
3.3 Stop Tunnel
Find the background job and kill it:
jobs
kill %1 # or the relevant job number