ngrok Commands Reference ​
FreshTunnel Commands ​
| Command | Description |
|---|---|
ngrok http 8080 | HTTP tunnel to port 8080 |
ngrok http 8080 --url https://example.ngrok.app | HTTP with custom domain |
ngrok http 192.168.1.2:80 | Forward to non-local service |
ngrok http https://localhost:8443 | Forward to local HTTPS |
ngrok http '[::1]:80' --url https://ipv6.example.com | Forward to IPv6 |
ngrok tcp 22 | TCP tunnel (SSH, databases) |
ngrok tls 80 --url tls://name.ngrok.app | TLS tunnel |
ngrok start foo bar | Start named endpoints from config |
ngrok start --all | Start all endpoints in config |
Configuration Commands ​
| Command | Description |
|---|---|
ngrok config add-authtoken TOKEN | Add your authtoken |
ngrok config add-api-key KEY | Add API key |
ngrok config check | Validate config and show location |
ngrok config edit | Open config file in editor |
Service Commands (Windows) ​
| Command | Description |
|---|---|
ngrok service install --config PATH | Install as Windows service |
ngrok service start | Start the service |
ngrok service stop | Stop the service |
ngrok service restart | Restart the service |
ngrok service uninstall | Remove the service |
API Commands ​
| Command | Description |
|---|---|
ngrok api endpoints list | List active endpoints |
ngrok api reserved-domains list | List reserved domains |
ngrok api tunnel-sessions list | List tunnel sessions |
Utility Commands ​
| Command | Description |
|---|---|
ngrok help | Show help text |
ngrok version | Show ngrok version |
ngrok update | Update ngrok to latest version |
ngrok diagnose | Troubleshoot connection issues |
ngrok completion | Generate shell tab completion |
Configuration File Location (Windows) ​
%HOMEPATH%\AppData\Local\ngrok\ngrok.ymlEnvironment Variables ​
| Variable | Description |
|---|---|
NGROK_AUTHTOKEN | Authtoken (overrides config) |
NGROK_API_KEY | API key (overrides config) |
Config File Example ​
yaml
version: "3"
authtoken: YOUR_TOKEN
endpoints:
- name: webapp
url: https://myapp.ngrok.app
traffic_policy:
on_http_request:
- actions:
- type: oauth
config:
provider: google
upstream:
url: 8080
protocol: http1
- name: api
url: https://myapi.ngrok.app
upstream:
url: 3000
protocol: http1Traffic Policy File Example ​
yaml
on_http_request:
- actions:
- type: basic-auth
config:
credentials:
- admin:password123Connectivity Details ​
| Property | Value |
|---|---|
| Connect address | connect.ngrok-agent.com:443 |
| Port | 443 (TLS) |
| CRL check | crl.ngrok-agent.com (port 80) |
| Update check | update.equinox.io |
| Heartbeat | Automatic, configurable |
Keyboard Shortcuts (Console UI) ​
| Shortcut | Action |
|---|---|
Ctrl+C | Stop ngrok |
Ctrl+U | Update ngrok (when prompted) |