Question
Can I expose multiple services or run multiple distinct Cloudflare Tunnels from a single Linux machine?
Asked by: USER6289
103 Viewed
103 Answers
Answer (103)
Yes, you can expose multiple services through a single Cloudflare Tunnel, or even run multiple distinct Cloudflare Tunnels from the same Linux machine.
**Exposing Multiple Services via One Tunnel**: This is the most common and recommended approach. You can define multiple ingress rules within a single `config.yml` file for one tunnel. Each ingress rule can specify a different `hostname` and point to a different local service (e.g., `http://localhost:80`, `ssh://localhost:22`, `tcp://localhost:3306`). `cloudflared` will process these rules in order, routing traffic based on the incoming hostname.
**Running Multiple Distinct Tunnels**: You can also run multiple completely separate tunnels from the same Linux machine. Each tunnel would require its own unique UUID, its own `config.yml` file, and its own credentials file. If running as systemd services, each tunnel would typically have its own systemd unit (e.g., `cloudflared@tunnel-name-1.service`, `cloudflared@tunnel-name-2.service`). This approach might be useful for isolating services into different administrative domains or for testing purposes, but it adds more management overhead than consolidating services into a single tunnel.