SOP 003: Expose a Local Service ​
Fresh| Field | Value |
|---|---|
| SOP ID | SOP-003 |
| Version | 1.0 |
| Status | Active |
| Last Updated | 2026-02-13 |
Purpose ​
Create an ngrok tunnel to expose a locally running service to the internet via a public HTTPS URL.
Prerequisites ​
Procedure ​
HTTP Endpoint (Most Common) ​
Expose a web app running on port 8080:
bash
ngrok http 8080ngrok displays a console UI showing your public URL:
Forwarding https://abc123.ngrok-free.app -> http://localhost:8080With a Custom Domain ​
bash
ngrok http 8080 --url https://example.ngrok.appForward to Non-Local Service ​
bash
ngrok http 192.168.1.2:80Forward to Local HTTPS ​
bash
ngrok http https://localhost:8443TCP Endpoint ​
For SSH, databases, or other non-HTTP protocols:
bash
ngrok tcp 22TLS Endpoint ​
For TLS-wrapped protocols:
bash
ngrok tls 80 --url tls://your-name.ngrok.appMultiple Endpoints ​
Define endpoints in your config file, then start them by name:
bash
ngrok start webapp api databaseWhat You Get ​
- Public HTTPS URL with a valid TLS certificate (auto-managed)
- Console UI showing traffic stats and request inspector
- Free dev domain assigned automatically on free plans
Verification Checklist ​
- [ ] Local service is running and accessible at
localhost:PORT - [ ]
ngrok http PORTshows forwarding URL - [ ] Public URL loads successfully in browser
- [ ] Console UI displays incoming requests
Troubleshooting ​
| Issue | Solution |
|---|---|
| Connection refused | Ensure local service is running on the specified port |
| 502 Bad Gateway | Local service crashed or isn't responding |
| Tunnel session expired | Free accounts have session limits; restart ngrok |
| ERR_NGROK_8012 | Account limit reached; upgrade or close other tunnels |