Using ngrok for Tunnel Configuration in ServBay
ngrok is a reverse proxy tool that creates a secure tunnel behind a firewall, allowing a local server to be accessed externally. This article provides a detailed introduction on how to use ngrok for tunnel configuration in ServBay.
Overview
ngrok creates a secure tunnel behind a firewall, allowing a local server to be accessed externally. In ServBay, you can use ngrok to expose the local ServBay host to the outside world. This article will introduce how to use ngrok to bind a ServBay host to a specific domain name.
ngrok Installation
First, you need to install ngrok on the ServBay host. If you have not installed ngrok yet, follow these steps to install:
Visit the ngrok official website: ngrok download page
Download the ngrok binary suitable for your operating system
Unzip the downloaded file and move the ngrok binary to the system's executable path. For example:
bashsudo unzip ~/Downloads/ngrok-v3-stable-darwin-arm64.zip -d /usr/local/bin
1Verify whether the installation was successful:
bashngrok version
1
Configuring ngrok Tunnel
Command Explanation
The command to configure the ngrok tunnel in ServBay is as follows:
ngrok http --domain=cunning-lacewing-fresh.ngrok-free.app https://servbay.host --request-header-add='host: servbay.host'
Command Analysis
ngrok http
: Start an HTTP tunnel--domain=cunning-lacewing-fresh.ngrok-free.app
: Specify the domain assigned by ngrokhttps://servbay.host
: Address of the local ServBay host--request-header-add='host: servbay.host'
: Add request headers, setting thehost
header toservbay.host
Example Command
Suppose your ServBay host is named servbay.local
, and you want to access this host through the domain cunning-lacewing-fresh.ngrok-free.app
assigned by ngrok, you can use the following command:
ngrok http --domain=cunning-lacewing-fresh.ngrok-free.app https://servbay.local --request-header-add='host: servbay.local'
After running this command, ngrok will create a tunnel from cunning-lacewing-fresh.ngrok-free.app
to servbay.local
.
Verify Configuration
To verify whether the ngrok configuration is successful, follow these steps:
Open a browser and go to the domain assigned by ngrok:
plaintexthttps://cunning-lacewing-fresh.ngrok-free.app
1You should be able to see the content of the ServBay host. If you see the homepage of the ServBay host or other expected content, it means that the ngrok tunnel configuration is successful.
Summary
Using ngrok for tunnel configuration in ServBay allows a local server to be accessed externally. Through this article, you can learn how to install ngrok and configure the tunnel.