LocalTunnel 서버 설정 문서
발행: (2025년 12월 5일 오전 09:44 GMT+9)
3 min read
원문: Dev.to
Source: Dev.to

1. 파일
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 LocalTunnel 클라이언트 명령 실행
nohup npx localtunnel --port 3000 --host http://34.68.37.115:8081 > tunnel.log 2>&1 &
- 이것은 LocalTunnel을 백그라운드에서 실행하고 출력은
tunnel.log에 기록합니다.
예시 로그 출력
nohup: ignoring input
your url is: http://angry-liger-20.34.68.37.115
2. 설치
2.1 사전 요구 사항
- Docker 및 Docker Compose가 설치되어 있음.
- Node.js와
npx가 설치되어 있음 (LocalTunnel 클라이언트를 실행하기 위해).
2.2 단계
-
구성 파일을 디렉터리로 복제하거나 복사합니다:
mkdir ~/localtunnel cd ~/localtunnel # Add docker-compose.yml, nginx.conf, site.conf -
LocalTunnel 서버와 Nginx 역방향 프록시를 시작합니다:
docker-compose up -dlt-server는 내부적으로 포트3000을 청취합니다.localtunnel-nginx는 외부에 포트8081을 노출합니다.
-
컨테이너가 실행 중인지 확인합니다:
docker ps
3. 사용법
3.1 LocalTunnel 클라이언트 시작
nohup npx localtunnel --port 3000 --host http://:8081 > tunnel.log 2>&1 &
- “를 공용 서버 IP 또는 도메인으로 교체합니다.
tunnel.log에 출력이 저장되며, 여기에는 공용 URL이 포함됩니다.
예시
your url is: http://angry-liger-20.34.68.37.115
3.2 로그 확인
cat tunnel.log
- 터널이 실행 중인지 확인하고 공용 URL을 표시합니다.
3.3 터널 중지
백그라운드 작업을 찾아 종료합니다:
jobs
kill %1 # or the relevant job number