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

@drsimplegraffiti's Holopin board

drsimplegraffiti

drsimplegraffiti

drsimplegraffi1

  • šŸ”­ Iā€™m currently working on All cheat sheets

  • šŸŒ± Iā€™m currently learning Java and Spring

Connect with me:

drsimplegraffiti drsimplegraffi1 15661401 drsimplegraffiti @drsimplegraffiti

Languages and Tools:

aws bash docker express firebase git graphql heroku java javascript jenkins jest linux mocha mongodb mysql nestjs nginx nodejs postgresql postman rabbitMQ redis spring travisci 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!