LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ngrok

creates secure tunnels to localhost

TLDR

Expose local port
$ ngrok http [8080]
copy
Expose with custom domain
$ ngrok http --domain=[myapp.ngrok-free.app] [8080]
copy
TCP tunnel
$ ngrok tcp [22]
copy
Start named tunnel from config
$ ngrok start [tunnel-name]
copy
Start all tunnels from config
$ ngrok start --all
copy
Set authentication token
$ ngrok config add-authtoken [token]
copy
TLS tunnel
$ ngrok tls [443]
copy
Expose with basic auth
$ ngrok http --basic-auth="[user]:[password]" [8080]
copy
Check configuration file validity
$ ngrok config check
copy
Diagnose connectivity
$ ngrok diagnose
copy

SYNOPSIS

ngrok [command] [options]

DESCRIPTION

ngrok creates secure tunnels from a public endpoint to a locally running service. It exposes local servers to the internet through a public URL without deploying or configuring firewalls.Common use cases include webhook development, demo presentations, testing mobile backends, and remote access to local services. The web inspection interface (default at localhost:4040) allows real-time traffic inspection and replay.

PARAMETERS

http PORT

Create HTTP tunnel to local port.
tcp PORT
Create TCP tunnel.
tls PORT
Create TLS tunnel (does not terminate TLS).
start name
Start named tunnel(s) from configuration file.
config SUBCOMMAND
Manage ngrok configuration (add-authtoken, check, edit).
diagnose
Run connectivity diagnostics to ngrok service.
service action
Manage ngrok as a system service (install, start, stop, restart, uninstall).
--domain NAME
Custom domain for tunnel endpoint.
--region REGION
Region for tunnel (us, eu, ap, au, sa, jp, in).
--log path
Write logs to file or "stdout"/"stderr".
--basic-auth USER:PASSWORD
Add HTTP basic authentication to the tunnel.
api SUBCOMMAND
Access the ngrok API (e.g., list tunnels, manage reserved domains).
--help
Display help information.

CAVEATS

Free tier has connection limits and randomized URLs that change on restart. An account and authtoken are required for most features. The --subdomain flag was replaced by --domain in newer versions.

HISTORY

ngrok was created by Alan Shreve to provide secure tunnels for local development.

SEE ALSO

Copied to clipboard
Kai