LocalTunnel Server Setup Documentation
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
npx installed (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 -d
-
lt-server listens internally on port 3000.
-
localtunnel-nginx exposes port 8081 externally.
- Verify containers are running:
docker ps
3. Usage
3.1 Start LocalTunnel Client
nohup npx localtunnel --port 3000 --host http://<your-server-ip>:8081 > tunnel.log 2>&1 &
- Replace
<your-server-ip> with your public server IP or domain.
-
tunnel.log stores 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 gives the public URL.
3.3 Stop Tunnel
- Find the process and kill it:
jobs
kill %1 # or the relevant job number
Top comments (0)