Skip to content

SOP 005: Install ngrok as a Windows Service ​

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

Purpose ​

Install ngrok as a native Windows service so it starts automatically on boot, restarts after crashes, and runs continuously in the background.

Prerequisites ​

  • ngrok installed and authenticated
  • Administrator privileges
  • A valid ngrok configuration file with endpoints defined

Procedure ​

Step 1: Create Configuration File ​

Create or edit the ngrok config file. Recommended location: C:\ngrok\ngrok.yml

bash
ngrok config edit

Example config with endpoints:

yaml
version: "3"
authtoken: YOUR_AUTHTOKEN

endpoints:
  - name: webapp
    url: https://your-domain.ngrok.app
    upstream:
      url: 8080
      protocol: http1

  - name: api
    url: https://your-api.ngrok.app
    upstream:
      url: 3000
      protocol: http1

Step 2: Validate Configuration ​

bash
ngrok config check

Step 3: Install the Service ​

Run as Administrator:

bash
ngrok service install --config C:\ngrok\ngrok.yml

Important

Do NOT move or delete the ngrok executable or config file after installation. The service references their exact locations.

Step 4: Start the Service ​

bash
ngrok service start

Step 5: Verify ​

Check Windows Services (services.msc) for the ngrok service, or run:

bash
ngrok service status

Service Management Commands ​

CommandDescription
ngrok service install --config PATHInstall the service
ngrok service startStart the service
ngrok service stopStop the service
ngrok service restartRestart the service
ngrok service uninstallRemove the service

What the Service Does ​

  • Starts when Windows boots
  • Automatically restarts after crashes
  • Manageable via Windows Services panel
  • Logs errors and warnings to Windows Event Log
  • Runs all endpoints defined in config (equivalent to ngrok start --all)

Verification Checklist ​

  • [ ] Config file exists and is valid
  • [ ] Service installed successfully
  • [ ] Service appears in Windows Services
  • [ ] Service status is "Running"
  • [ ] Endpoints are accessible via public URLs
  • [ ] Service survives a system restart

Troubleshooting ​

IssueSolution
Exit code 5Config file not found or no permission to access it
Input/output errorSame as exit code 5 — verify config path
Service won't startCheck Windows Event Log for detailed errors
Permission deniedRun commands as Administrator
Endpoints not accessibleVerify the upstream services are running

See Also ​

Built with VitePress + Claude RAG Chat