Updated: 28 September 2026 · Applies to: AlmaLinux 9 / Rocky Linux 9

CentOS 7 reached end of life on 30 June 2024, so this guide now uses AlmaLinux 9 / Rocky Linux 9 (the steps also suit other RHEL 9 rebuilds).

Caddy is a modern web server that sets up HTTPS automatically with free certificates.

Install Caddy

Ubuntu 24.04 / Debian 12 (official Caddy repository):

apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
apt update && apt install caddy

AlmaLinux 9 / Rocky Linux 9:

dnf install 'dnf-command(copr)'
dnf copr enable @caddy/caddy
dnf install caddy
systemctl enable --now caddy

Open the firewall

ufw allow 80,443/tcp                                   # Ubuntu / Debian with UFW
firewall-cmd --permanent --add-service=http --add-service=https && firewall-cmd --reload   # AlmaLinux / Rocky

Serve a static site

example.com {
    root * /var/www/example.com
    file_server
}

Put this in /etc/caddy/Caddyfile and run systemctl reload caddy.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket