0% found this document useful (0 votes)
31 views

Working With Ngrok to host your private ip to public network

This document provides a step-by-step guide on how to use ngrok to expose a local server to the public internet. It includes instructions for downloading, installing, and authenticating ngrok, as well as starting a local server and creating a tunnel. Additionally, it offers troubleshooting tips and common commands for using ngrok effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Working With Ngrok to host your private ip to public network

This document provides a step-by-step guide on how to use ngrok to expose a local server to the public internet. It includes instructions for downloading, installing, and authenticating ngrok, as well as starting a local server and creating a tunnel. Additionally, it offers troubleshooting tips and common commands for using ngrok effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Working With Ngrok to host your private ip to public network

Step 1: Download and Install ngrok


1. Download ngrok

○ Go to the official ngrok website: https://ngrok.com/download.


○ Click on "Download for Windows" to get the ZIP file.
2. Extract ngrok

○ Extract the ngrok.zip file into a folder (e.g., C:\ngrok).


3. Add ngrok to the System Path (Optional but recommended):

○ Open the Start Menu, search for "Environment Variables", and open it.
○ In System Properties, click Environment Variables.
○ Find and edit the Path variable under System variables.
○ Click New and add the folder where ngrok.exe is located (e.g., C:\ngrok).
○ Click OK to save.
4. Verify Installation
Open Command Prompt (cmd) and run:

ngrok --version

Step 2: Authenticate ngrok


1.Create an ngrok Account

Go to https://dashboard.ngrok.com/signup and sign up for a free account.

2.Get Your Authtoken

After signing up, visit: https://dashboard.ngrok.com/get-started/your-authtoken.

Copy the authtoken provided.


3.Install the Authtoken

Run the following command in Command Prompt:

ngrok authtoken YOUR_AUTH_TOKEN

Replace YOUR_AUTH_TOKEN with the token you copied.

Example:

ngrok authtoken 2Nabc1234YourTokenHere

Step 3: Start a Local Server


Before using ngrok, make sure you have a local server running. For example:

If you're running a server on port 33259 (like a web app, API, or testing server), verify it works
locally:
http://localhost:33259

Step 4: Use ngrok to Expose the Server


Run the following command to create a tunnel for port 33259:

ngrok http 33259 --host-header="localhost:33259"

Explanation of Command:

● http 33259: Tells ngrok to forward requests to port 33259.


● --host-header="localhost:33259": Resolves hostname issues for some local
servers.

Step 5: Access the Public URL


Once you run the command, ngrok will display output similar to this:
Forwarding https://abc123.ngrok.io -> http://localhost:33259

● The public URL (https://abc123.ngrok.io) can be used to access your local


server from anywhere on the internet.

Step 6: Troubleshooting
If something goes wrong:

1. Server Not Running: Ensure your local server is running on port 33259.
2. Firewall Issues: Allow port 33259 in your system firewall.
3. Detailed Logs: Add --log=stdout to the ngrok command:
ngrok http 33259 --host-header="localhost:33259" --log=stdout

Common Commands

● Start a TCP tunnel (for non-HTTP traffic):


ngrok tcp PORT
● View status:
ngrok status
● Start an HTTP tunnel:
ngrok http PORT

Final Notes
● Make sure your internet connection is stable.
● Free accounts might disconnect tunnels after 8 hours.
● For advanced features like custom domains, upgrade to a paid plan.

You might also like