cloudflared connects your machine to the Cloudflare network. It is the daemon that runs Cloudflare Tunnels (formerly Argo Tunnel), allowing you to securely expose local web servers to the internet without opening any firewall ports or setting up port forwarding.
Installation
Download the binary directly from Cloudflare, or use the package manager.
# Debian / Ubuntu
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared.deb
# RHEL / CentOS / Fedora
curl -L --output cloudflared.rpm https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-x86_64.rpm
sudo dnf install ./cloudflared.rpm
# Arch Linux (AUR)
yay -S cloudflaredQuick Start (Temporary Tunnel)
You can quickly expose a local port (e.g., a React app on port 3000) to a random trycloudflare.com URL without an account.
cloudflared tunnel --url http://localhost:3000Permanent Tunnel Setup (Requires Cloudflare Account)
To use your own domain, you must authenticate and create a named tunnel.
1. Authenticate
cloudflared tunnel login
# This will output a URL. Open it in a browser and authorize your domain.2. Create a Tunnel
cloudflared tunnel create my-tunnel
# This creates a UUID for the tunnel and generates a credentials file in ~/.cloudflared/3. Route DNS
Route traffic from your domain to the tunnel UUID.
cloudflared tunnel route dns my-tunnel app.mydomain.com4. Create Configuration File (~/.cloudflared/config.yml)
tunnel: <Tunnel-UUID>
credentials-file: /root/.cloudflared/<Tunnel-UUID>.json
ingress:
- hostname: app.mydomain.com
service: http://localhost:8080
- hostname: ssh.mydomain.com
service: ssh://localhost:22
- service: http_status:4045. Run the Tunnel
cloudflared tunnel run my-tunnelRunning as a Service (Systemd)
To run the tunnel continuously in the background on a server:
sudo cloudflared service install
sudo systemctl start cloudflared
sudo systemctl enable cloudflared
sudo systemctl status cloudflared(Note: When running as a service, the configuration file is usually read from /etc/cloudflared/config.yml)