This article will show easy steps to set up and use ngrok.
Sign Up for ngrok here and download it. Unzip your files and run ngrok. You can also install ngrok via snap using:
ADD AUTHTOKEN TO NGROK
Add your auth token. It is available in the left pane of the dashboard. One can either edit the ngrok.yml commonly stored in ~/.ngrok2/ngrok.yml.
or simply type:
This will add your auth token to the ngrok.yml configuration file. By adding authtoken, ngrok grants, you accessed additional features and increased session times.
Let’s run ngrok with HTTP. A local port number is needed for this. The following command will secure a public URL for the port 80 webservers.
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Account Arslan Aslam (Plan: Free) Version 2.3.35
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://916f560728c3.ngrok.io -> http://localhost:80
Forwarding https://916f560728c3.ngrok.io -> http://localhost:80
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
Let’s break this down. After showing online status, it identifies the user and the version installed, identifies the region. Then Ngrok informs that the web interface for ngrok is on localhost port 4040. The two URLs shown in the next line are the public addresses through which your local site can now be accessed. Note there are two URLs, one with http and the other with an https connection.
Let’s explore the status page.
As the forwarded address (something like this 757de47032a1.ngrok.io) is accessed, Ngrok will log requests in the CLI and the web interface
GET /favicon.ico 404 File not found
GET / 200 OK
Suppose you have a website that you need to test, and it is working on port 1337 of your localhost. We’ll use the following command:
This will tunnel all the http traffic from the ngrok address to port 1337 of your device.
Using the paid plan, custom subdomains can be set using:
This will tunnel port 80 traffic to arslan.ngrok.io.
Also, Tunnel TCP traffic on port <port_number> by using:
Ngrok can be updated using:
Ngrok is a capable tool and can be very helpful in Testing websites. It may not be a good idea to host your live site on your PC, so using ngrok for live sites is discouraged. Ngrok has made site testing easy, efficient, and straightforward.
Happy Testing !!!