NGROK Tutorial
Posted: Sun Mar 08, 2020 6:27 pm
Ngrok is a free web service that allows you to quickly create a secure HTTPS connection to a PC or web service. It's a simple and easy way to access your Blue Iris PC over HTTPS from anywhere in the world and requires very little setup. It does not require a VPN, certificates, changing your router settings, or anything else.
For complete information, visit Ngrok.com.
If you want to use Ngrok to securely access your Blue Iris web server, follow this walk-through.
1) Create an account on Ngrok.com (it's free): https://ngrok.com/
2) Download the Ngrok executable, unzip it and put it someplace convenient. (https://ngrok.com/download)
3) Register your API Authtoken: https://ngrok.com/docs#getting-started-authtoken (you only have to do this once).
4) Connect your account. This will become important later, because connecting your account will let you find your open tunnels (HTTPS connections) in the dashboard. Do this by executing this command:
5) Create a .bat or .cmd file that will start Ngrok with the correct parameters. Name it whatever you want, for example, "ngrok-starter.cmd".
In the example below, the Ngrok executable is in a folder named "NRGOK" on the desktop, and the BI webserver is located on the LAN at "192.168.1.2:99". Replace "<your username>" with your actual Windows username. The cmd file can go in the same directory if you want. I placed mine in the main C:\Windows directory.
This example starts Ngrok with an HTTPS connection on port 99:
1) Change the IP to whatever IP address your router resides on.
2) Change "99" to match whichever port you've forwarded for your Blue Iris web server.
Note that including the IP address appears to be PC-dependent; some PCs require you to 'force' the IP assignment, some don't. If it doesn't work using an IP address, try starting Ngrok without specifying the IP: ngrok.exe https 99
6) Test the connection by running the cmd file. You should get a command window showing that Ngrok started and the current, ephemeral connection URL.
It'll be a random URL similar to "https://fuj47645.ngrok.io". This will change every time you start Ngrok, but that's okay- you'll always be able to find the current URL in the Ngrok Status Dashboard whenever you need to.
7) Go to the Ngrok Status Dashboard and confirm the HTTPS tunnel has been created: https://dashboard.ngrok.com/status You should see the same URL there.
8) Click the HTTPS URL. If you've done everything right so far you should see the BI login screen.
If you prefer to start Ngrok manually each time, then you're done- you can skip to the end and start using Ngrok.
9) Create a Scheduled Task in Windows that will run on startup (before any user logs in).
- -
Save and close the dialog box.
Open the Scheduled Tasks screen again and verify that the task has been added. You should see something similar to what's shown in the image below:
- -
10) Test by rebooting Windows. After Windows has finished booting BUT BEFORE YOU LOGIN, go to the Ngrok Status Dashboard, refresh it, and confirm that two default tunnels (HTTP and HTTPS) have been started: https://dashboard.ngrok.com/status
11) If the tunnels have been started, clicking on the HTTPS URL should show you your BI server logon through a secure, https connection.
12) From now on, each time you start Windows it will run Ngrok and create a new secure tunnel URL for you to use, wherever you are.
If you have any questions, please ask them in the forum.
For complete information, visit Ngrok.com.
If you want to use Ngrok to securely access your Blue Iris web server, follow this walk-through.
1) Create an account on Ngrok.com (it's free): https://ngrok.com/
2) Download the Ngrok executable, unzip it and put it someplace convenient. (https://ngrok.com/download)
3) Register your API Authtoken: https://ngrok.com/docs#getting-started-authtoken (you only have to do this once).
4) Connect your account. This will become important later, because connecting your account will let you find your open tunnels (HTTPS connections) in the dashboard. Do this by executing this command:
Code: Select all
.\ngrok authtoken <your authtoken>
5) Create a .bat or .cmd file that will start Ngrok with the correct parameters. Name it whatever you want, for example, "ngrok-starter.cmd".
In the example below, the Ngrok executable is in a folder named "NRGOK" on the desktop, and the BI webserver is located on the LAN at "192.168.1.2:99". Replace "<your username>" with your actual Windows username. The cmd file can go in the same directory if you want. I placed mine in the main C:\Windows directory.
This example starts Ngrok with an HTTPS connection on port 99:
Code: Select all
C:\Users\<your username>\Desktop\NGROK\ngrok.exe https 192.168.1.2:99
1) Change the IP to whatever IP address your router resides on.
2) Change "99" to match whichever port you've forwarded for your Blue Iris web server.
Note that including the IP address appears to be PC-dependent; some PCs require you to 'force' the IP assignment, some don't. If it doesn't work using an IP address, try starting Ngrok without specifying the IP: ngrok.exe https 99
6) Test the connection by running the cmd file. You should get a command window showing that Ngrok started and the current, ephemeral connection URL.
It'll be a random URL similar to "https://fuj47645.ngrok.io". This will change every time you start Ngrok, but that's okay- you'll always be able to find the current URL in the Ngrok Status Dashboard whenever you need to.
7) Go to the Ngrok Status Dashboard and confirm the HTTPS tunnel has been created: https://dashboard.ngrok.com/status You should see the same URL there.
8) Click the HTTPS URL. If you've done everything right so far you should see the BI login screen.
If you prefer to start Ngrok manually each time, then you're done- you can skip to the end and start using Ngrok.
9) Create a Scheduled Task in Windows that will run on startup (before any user logs in).
- Open the Windows Task Scheduler.
- Create a Basic Task.
- Name it whatever you want, such as "NGROK_startup".
- Fill in the Description so you'll know what the heck this is later (i.e. "Starts ngrok when Windows boots and before any user logs in")
- Click Next, and choose When the computer starts.
- Click Next, and choose Start a program.
- Click Next, and click Browse, then find and select your batch/cmd file (e.g. "ngrok-starter.cmd").
- Check the box that says "Open the Properties dialog for this task when I click Finish". Refer to the image below for additional parameters you need to set. Set the parameters as shown below to run the batch/cmd file as the user you specified earlier in the ngrok batch file.
- -
Save and close the dialog box.
Open the Scheduled Tasks screen again and verify that the task has been added. You should see something similar to what's shown in the image below:
- -
10) Test by rebooting Windows. After Windows has finished booting BUT BEFORE YOU LOGIN, go to the Ngrok Status Dashboard, refresh it, and confirm that two default tunnels (HTTP and HTTPS) have been started: https://dashboard.ngrok.com/status
11) If the tunnels have been started, clicking on the HTTPS URL should show you your BI server logon through a secure, https connection.
12) From now on, each time you start Windows it will run Ngrok and create a new secure tunnel URL for you to use, wherever you are.
- Note that the tunnel URL changes every time you start Windows. Just go to the Ngrok Status Dashboard to see what the current URL is: https://dashboard.ngrok.com/status
- Also note that when you login, you won't see the CMD window that's running Ngrok, it'll be hidden and running in the background. Use the Task Manager to stop it if you need to.
If you have any questions, please ask them in the forum.