Web Application 개발 도구

ngrok

blogger903 2024. 8. 5. 18:25
728x90

개발환경

- Apple M2 Pro

- macOS Sonoma

ngrok 설치

brew로 설치합니다

brew install ngrok/ngrok/ngrok

ngrok 사용을 위해 authtoken을 설정해줍니다

ngrok config add-authtoken <token>

간단 배포
8080포트로 웹애플리케이션을 띄운상태에서 아래와같이 명령해줍니다

ngrok http http://localhost:8080

무료 계정인 경우 사용이 제한되며 정말 간단히 찍어볼때 사용합니다
ngrok pricing

ngrok config

ngrok 주요 기능은 secured 리버스 프록시입니다.
full configuration은 상당히 많고 현재는 간단히 ngrok을 service로 로컬 API에 secured url을 생성하는 기능으로 사용중입니다

예시

ngrok start with configuration

ngrok start --all --config ./ngrok.yml

참고: ngrok agent configuration file

ngrok.yml

version: 2
authtoken: <token>
tunnels:
  sever1:
    proto: http
    addr: 3001
  server2:
    proto: http
    addr: 3002

authtoken 확인

ngrok config check
Valid configuration file at <PATH>/ngrok/ngrok.yml

ngrok 동작 확인