DEV Community

Cover image for ngrok: Expose a local web server to the internet
Abayomi Ogunnusi
Abayomi Ogunnusi

Posted on

ngrok: Expose a local web server to the internet

Hello devs, I got introduced to a tool that allows you to expose a web server running on your local machine to the internet. Its ngrok
exposed secret

Setup

Go to Ngrok Link to signup and download the ngrok for your operating system
ngrok1

ngrok 5

Let's say for example you are working on a node app running on http://localhost:3000 and you want to expose/share your server to a colleague without using ipconfig.

🎯 Launch the ngrok
ngrok2

Then type the following command

ngrok http <your port number>
Enter fullscreen mode Exit fullscreen mode

In my case ngrok http 3000

You should get something like this
ngrok4

🎯 Copy the forwarding link highlighted in red and test on any browser. (Okay, the moment of truth, what did you get? 😁)
ngrok 4


Password protect your tunnel

ngrok http -auth="username:password" 8080
Enter fullscreen mode Exit fullscreen mode

In my case, it will be
ngrok http -auth="drsimple:ngrokpassword" 3000
ngrok 6
Open the ngrok terminal and paste the above command.
copy the forwarding link and paste it into your browser.

This time you get:
ngrok 7

🎯 Lastly, let us look at how we can run ngrok in our command prompt in few steps
Copy the path where you downloaded ngrok

ngrok 8
🎯 Go to the environment variable
ngrok 9
Click on the path, Click Edit, New, and Paste the path copied earlier.
ngrok 11
Repeat the above step for the system variable.

🎯 Your command prompt should be able to run ngrok successfully.
ngrok 13

πŸ‘¨πŸ½β€πŸ« For further customization check the recommended video and the ngrok docs.

I hope this was helpful. Thanks πŸ™ŒπŸ½ for reading.

GitHub logo drsimplegraffiti / drsimplegraffiti

Config files for my GitHub profile.

Calm Developer

Hi πŸ‘‹, I'm Abayomi.

A Software Engineer interested in Backend

Software Engineer

A

drsimplegraffiti

drsimplegraffiti

drsimplegraffi1

Languages and Tools:

aws bash docker express javascript linux mongodb mysql nginx nodejs postgresql rabbitMQ redis typescript

drsimplegraffiti

Β drsimplegraffiti

drsimplegraffiti

Dev.to Post

πŸ”— Improve your Github Profile

πŸ”— Download Browser Page as PDF

πŸ”— Send mails using NodeJS

πŸ”— Chat App using Socket.io

πŸ”— Expose a local web server to the internet

πŸ”— Web scraping using Node Js

πŸ”— Bash Terminal Guide

πŸ”— Best Practices: Node JS Security

πŸ”— Postman Hacks

πŸ”— Time Zone: Nodejs

πŸ”— Conditional Rendering : REACT




Reference

ngrok docs
Reference Video by CyberRyker

Top comments (2)

Collapse
 
drsimplegraffiti profile image
Abayomi Ogunnusi

@nqrz ...Glad it was helpful

Collapse
 
nqrz profile image
Nizar Ahmad Baihaqi

omg, this is amazing!