Setting Up ngrok for Local Web Development

Sometimes, you’ll need to expose a local server, running on your computer, to the internet. This can be useful for testing a web application before deploying it to a remote server.

Find out how to use ngrok, a common tool for exposing local web servers to the internet.

4

Using ngrok for Local Web Development

ngrok has been a tunneling solution for running local web servers on the internet since 2015.

Using ngrok, it’s possible to create a public URL that maps to your local server, making it easy for others to access their work from anywhere in the world. You can then test your applications from different devices and web browsers, and troubleshoot them using ngrok’s request and response logs.

Woman and man setting up iMac together

When dealing with a public tunnel, you might have security concerns. ngrok supports secure tunnels with SSL encryption, making it safe to use for sensitive data and applications. All these features have made ngrok a valuable and popular tool for developers working on a personal project or collaborating with others.

Installing ngrok on Your Computer

Getting started with ngrok’s primary features is completely free and very straightforward. Although there is a paid version of ngrok that offers more features. Let’s learn how to install and set up ngrok on your computer.

To install ngrok on your computer, head to the officialngrok download page.

screenshot of ngrok’s download web page with its download options

You should then proceed to download ngrok for your specific OS (Operating System) either by downloading theZIP file and extracting itor installing it using a package manager like Chocolatey or Homebrew.

To install ngrok with Chocolatey or Homebrew on Windows and macOS, you will need to have either package manager installed.

screenshot of the ngrok signup web page with a signup form

To install Chocolatey on Windows, run this command inside the Windows PowerShell administrator:

To install Homebrew on macOS, run this command in your terminal:

screenshot of the ngrok websites auth token web page

Now you have the appropriate package managers, and you can install ngrok on your computer using either one.

Creating a New Local ngrok Tunnel With Your Account

To create a ngrok tunnel to expose your local server, you will need to sign up for a ngrok account and create an authentication token.

Step 1: Sign Up

Head tongrok’s signup page, fill in the form with your required details, and click onSign Up.

Step 2: Add Token to Config

Now you have an account, you will need to add your automatically generated authentication token to thengrok.ymlconfig file. This token is unique to your account, so you should keep it secure. To add the auth token, navigate to theYour Authtokenpage in the side navigation bar.

you’re able to copy your auth token and run the demonstrated command in your terminal to set the config file:

Step 3: Run ngrok

Once you’ve completed the previous steps, you can create a ngrok tunnel to run your server.

To do this, run the following command with a preferred port number.

For example:

You now have a local ngrok tunnel running on your computer.

Handling Common Setup Issues

The Benefits of Using ngrok for Local Web Development

Whether you’re working on a personal project or collaborating with a team, ngrok is valuable in your web development toolkit. Its compatibility with various platforms and programming languages makes it suitable for web application testing, collaboration, or demoing projects to clients.

It’s easier than you think to get your own proxy server up and running. Here’s everything you need to know.

These films will leave you questioning humanity, but also wanting more.

Taming data is easier than it looks.

It saves me hours and keeps my sanity intact.

Flagship price, mid-range phone.

OneDrive is one of the best, but it has a catch.

Technology Explained

PC & Mobile