![Forrest logo](/images/logo.png)
cloudflared:tldr:27dc1
cloudflared: Establish a tunnel to a host in Cloudflare from the local server.
$ cloudflared tunnel --hostname ${hostname} localhost:${port_number}
try on your machine
The command cloudflared tunnel --hostname ${hostname} localhost:${port_number}
sets up a tunnel using cloudflared
, a tool provided by the Cloudflare service. This tunnel connects a specified hostname to a local machine on a specific port number.
Let's break down the command:
cloudflared
is the command used to invoke thecloudflared
tool.tunnel
is the subcommand that specifies the action to set up a tunnel.--hostname ${hostname}
is an option/flag that tellscloudflared
the desired hostname for the tunnel.${hostname}
is a placeholder indicating that you need to provide the actual hostname value.localhost:${port_number}
defines the target endpoint for the tunnel.localhost
refers to the local machine, and${port_number}
is a placeholder indicating that you need to provide the actual port number value.
To use this command, you should replace ${hostname}
with the desired hostname (e.g., example.com
) and ${port_number}
with the port number on your local machine you want to expose (e.g., 8080
). This will create a tunnel that forwards traffic sent to example.com
to the local machine's port 8080
.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.