Methods of payment Abuse

Configuring tunnels in the Nginx configuration file

06.01.2023, 14:15

Ngrok has a configuration file, it contains an authorization token. Often, while working with the software, there is a need to run a command, it is quite long, so to shorten the tunnel start command, you can use a configuration file.

Configuration file in Yaml format

The command can be described in this file, and then run by name. Ngrok stores the configuration in Yaml format in the home folder in the .config folder. But there is no need to edit the file directly. There is a config edit for editing:

ngrok config edit

The tunnels section should be added to the configuration file.

The syntax of the tunnel description is as follows:

tunnels:
tunnel name:
proto: protocol
addr: port

Other parameters that were previously passed on the command line are also available here.:

basic_auth - add HTTP authorization;

host_header - replace the value of the Host header;

inspect - whether to save requests for inspection, enabled by default;

schemes - available schemes: http and/or https.

specify your domain name for the service, available only in a paid subscription.

To create an example tunnel for port 80, with the Host header replaced by example.local, add the following lines to the tunnels section:

example:

proto: http

addr: 80

host_header: "example.local"

Now you know how to create a command in a configuration file.