Skip to content

SOP 003: Expose a Local Service ​

Fresh
FieldValue
SOP IDSOP-003
Version1.0
StatusActive
Last Updated2026-02-13

Purpose ​

Create an ngrok tunnel to expose a locally running service to the internet via a public HTTPS URL.

Prerequisites ​

  • ngrok installed and authenticated (SOP 001, SOP 002)
  • A local service running on a known port

Procedure ​

HTTP Endpoint (Most Common) ​

Expose a web app running on port 8080:

bash
ngrok http 8080

ngrok displays a console UI showing your public URL:

Forwarding   https://abc123.ngrok-free.app -> http://localhost:8080

With a Custom Domain ​

bash
ngrok http 8080 --url https://example.ngrok.app

Forward to Non-Local Service ​

bash
ngrok http 192.168.1.2:80

Forward to Local HTTPS ​

bash
ngrok http https://localhost:8443

TCP Endpoint ​

For SSH, databases, or other non-HTTP protocols:

bash
ngrok tcp 22

TLS Endpoint ​

For TLS-wrapped protocols:

bash
ngrok tls 80 --url tls://your-name.ngrok.app

Multiple Endpoints ​

Define endpoints in your config file, then start them by name:

bash
ngrok start webapp api database

What 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 PORT shows forwarding URL
  • [ ] Public URL loads successfully in browser
  • [ ] Console UI displays incoming requests

Troubleshooting ​

IssueSolution
Connection refusedEnsure local service is running on the specified port
502 Bad GatewayLocal service crashed or isn't responding
Tunnel session expiredFree accounts have session limits; restart ngrok
ERR_NGROK_8012Account limit reached; upgrade or close other tunnels

See Also ​

Built with VitePress + Claude RAG Chat