Independent testing Checked regularly Curated self-hosting guides 5 VPS providers tested

guide

How to Self-Host Headscale on a VPS (Complete Guide)

Learn how to self-host Headscale on a VPS with a step-by-step 2026 guide covering install, configuration, and securing Headscale for reliable daily use.

Headscale is an alternative coordination server for Tailscale clients. It manages identities, node discovery, keys, routes, and policy. It is not the VPN tunnel itself. Traffic between devices normally uses Tailscale’s data plane, with relays used when a direct path is unavailable.

This setup follows the official Headscale package, configuration, registration, and upgrade documentation. It was checked against stable release v0.29.5 on 21 October 2026. Read the release notes again if a newer stable version is available when you install.

Decide whether Headscale fits

Headscale is designed around one tailnet and suits a personal network, homelab, or small organization that can operate its own Linux service. Choose the hosted Tailscale control plane instead if you do not want to own DNS, TLS, upgrades, policy, backups, and recovery.

Before ordering a VPS, make sure the plan provides:

Headscale’s official requirements do not publish a universal RAM minimum. Start with a small current plan, observe memory and disk use, and resize from evidence. Do not choose from an old fixed-price table.

VPS options to check

Disclosure: the provider links in this table are affiliate links. We may earn a commission if you buy, at no added cost to you. The technical checklist above is the same for every provider.

ProviderCheck before checkoutProvider link
ContaboPublic IP, restore options, selected region, and current billing termsCheck Contabo
Hetzner CloudPublic IP pricing, backups, selected region, and current limitsCheck Hetzner
DigitalOceanPublic IP, backups, selected region, and current Droplet termsCheck DigitalOcean
VultrPublic IP, snapshots, selected region, and current instance termsCheck Vultr
Linode by AkamaiPublic IP, backups, selected region, and current plan termsCheck Linode

The commands below are provider-neutral. If you want the same European starting point used in many of our VPS walkthroughs, you can review Hetzner Cloud, but verify today’s terms and location before paying. Our Headscale VPS shortlist explains the selection criteria in more detail.

The working architecture

Use this path for a simple single-server installation:

Tailscale client
    -> HTTPS on tcp/443
    -> Caddy on the VPS
    -> Headscale on 127.0.0.1:8080

Headscale metrics stay on 127.0.0.1:9090
SQLite data stays under /var/lib/headscale

Create an A record for your hostname and, if available, an AAAA record. If the zone uses Cloudflare, leave this Headscale record as DNS-only. The official integration guide says Cloudflare Proxy and Cloudflare Tunnel do not support the WebSocket POST behavior required by the Tailscale Control Protocol.

1. Prepare Ubuntu and install Headscale

The official DEB packages support Ubuntu 22.04 or newer and Debian 12 or newer. They create a dedicated headscale user, install a default configuration, and provide a systemd service.

Connect by SSH, update the host, and install the tools used below:

sudo apt update
sudo apt upgrade -y
sudo apt install -y wget ca-certificates

Download the package for the version and architecture you intend to run. This example pins the version checked for this guide instead of pulling an unreviewed latest image:

HEADSCALE_VERSION="0.29.5"
HEADSCALE_ARCH="amd64"

wget --output-document=headscale.deb \
  "https://github.com/juanfont/headscale/releases/download/v${HEADSCALE_VERSION}/headscale_${HEADSCALE_VERSION}_linux_${HEADSCALE_ARCH}.deb"

sudo apt install ./headscale.deb

Use arm64 instead of amd64 only if that is your server architecture. The official release installation page is the source of truth for package names and supported systems.

2. Configure the public URL and local listeners

Keep the packaged example that matches your installed release. Back up the active file before editing it:

sudo cp /etc/headscale/config.yaml /etc/headscale/config.yaml.before-public-url
sudo nano /etc/headscale/config.yaml

Change the relevant keys in the existing file. Do not replace the whole version-matched configuration with a short snippet from a different release.

server_url: https://headscale.example.com
listen_addr: 127.0.0.1:8080
metrics_listen_addr: 127.0.0.1:9090
grpc_listen_addr: 127.0.0.1:50443

trusted_proxies:
  - 127.0.0.1/32
  - ::1/128

tls_cert_path: ""
tls_key_path: ""

Replace headscale.example.com with your DNS name. Empty TLS paths mean the reverse proxy terminates TLS. Validate the file before restarting:

sudo headscale configtest
sudo systemctl restart headscale
sudo systemctl status headscale --no-pager

The official configuration reference says to use the example from the same release tag. The development branch can contain settings that your installed version does not understand.

3. Put Caddy in front of Headscale

Install Caddy using its current official instructions for your distribution. Then replace /etc/caddy/Caddyfile with the hostname-adjusted configuration below:

http://headscale.example.com {
    handle /generate_204 {
        respond 204
    }

    handle * {
        redir https://{host}{uri}
    }
}

headscale.example.com {
    reverse_proxy 127.0.0.1:8080 {
        header_up True-Client-IP {remote_host}
        header_up X-Real-IP {remote_host}
    }
}

This follows the Headscale project’s Caddy reverse-proxy example. Caddy obtains the certificate, redirects HTTP, and passes the control protocol to the local Headscale listener.

Check and reload Caddy:

sudo caddy validate --config /etc/caddy/Caddyfile
sudo systemctl reload caddy
sudo systemctl status caddy --no-pager

Allow the actual SSH port and the public web ports in your host firewall. The OpenSSH profile below assumes the default SSH service. If you changed the SSH port, add that port first, keep the current session open, and confirm a second SSH login before enabling UFW. Do not expose 8080, 9090, or 50443 to the internet in this setup.

sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw status verbose
sudo ufw enable

UDP 3478 is needed only if you deliberately enable Headscale’s embedded DERP server. Review the official ports list before enabling optional services.

4. Register the first device

Create a Headscale user on the server:

sudo headscale users create alice

On the device that already has the Tailscale client installed, start registration:

tailscale up --login-server https://headscale.example.com

The client shows an Auth ID. Approve it on the server:

sudo headscale auth register --user alice --auth-id YOUR_AUTH_ID
sudo headscale nodes list

These are the current interactive commands in Headscale’s registration documentation. Pre-authenticated keys are better for unattended service nodes, but they need their own expiry, reuse, and tag decisions.

5. Add policy before calling the network private

Encryption in the data plane does not replace access control. Headscale loads no policy by default, which means traffic between nodes is allowed. Define a policy file, point policy.path at it in config.yaml, and reload the service. The current Headscale policy reference recommends Grants for new policies and documents the supported differences from Tailscale.

Also decide how administrators authenticate, who can register nodes, which routes are approved, and how lost devices are removed. Self-hosting gives you operational control, not automatic security.

6. Back up and upgrade safely

For the standard SQLite installation, protect both /etc/headscale and /var/lib/headscale. Stop the service for a consistent file-level backup:

sudo systemctl stop headscale

TIMESTAMP=$(date +%Y%m%d%H%M%S)
sudo cp -aR /etc/headscale "/etc/headscale.backup-${TIMESTAMP}"
sudo cp -aR /var/lib/headscale "/var/lib/headscale.backup-${TIMESTAMP}"

sudo systemctl start headscale

Copy the backup off the VPS and test a restore procedure before you need it. Headscale runs database migrations during upgrades. Its upgrade guide requires moving through stable minor versions in order, reading each release note, taking a backup, updating the version-matched configuration, and then starting the service.

Quick failure checks

For related architecture choices, compare Headscale and Tailscale self-hosting and review the domain and TLS setup guide.

FAQs

Does Headscale carry all VPN traffic?

No. Headscale is the coordination server. Tailscale clients establish the data path, usually directly between devices. A DERP relay may carry encrypted packets when a direct connection cannot be made.

Can Headscale run behind the Cloudflare orange cloud?

Not in the supported reverse-proxy path documented by Headscale. Use a DNS-only record so clients reach your VPS directly. Cloudflare Proxy and Cloudflare Tunnel do not support the required WebSocket POST behavior.

Is Docker required?

No. The Headscale project recommends its DEB package for supported Ubuntu and Debian systems. Container instructions are community documentation and the project states they are not verified by Headscale developers.

How much RAM does Headscale need?

The official requirements do not define one universal amount. Usage depends on nodes, routes, policy, logging, and optional services. Start small, monitor the actual process and database, then resize from measurements.

What must be backed up?

For the standard package and SQLite setup, back up /etc/headscale and /var/lib/headscale, including the SQLite database. Keep a copy outside the VPS and verify that you can restore it.