Caddy foundations

Install and inspect Caddy

Install an official Caddy build, record its version and modules, and understand why the exact binary matters.

10 minute lesson

~~~

Caddy is a web server written in Go. It ships as a single self-contained binary with no dependencies, and it manages HTTPS certificates for you out of the box.

Before any of that matters, you need the right binary on your machine. Caddy is modular: features like DNS providers are compiled into the binary itself, so two Caddy installs with the same version number can behave differently. Knowing exactly what you installed saves you hours of confusion later.

On macOS, install it with Homebrew:

brew install caddy

On Debian or Ubuntu, add the official repository and install the package:

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

The package does more than copy a binary. It creates a dedicated caddy system user, installs a systemd service, and drops a default configuration at /etc/caddy/Caddyfile. We’ll use all of that later in the course.

Now inspect what you got:

caddy version
caddy build-info
caddy list-modules --packages

caddy version prints something like v2.8.4. caddy build-info shows the Go version and every dependency compiled into the binary. caddy list-modules --packages lists the modules this build contains, with non-standard ones flagged at the end of the output.

Write down the version and any extra modules. When something behaves oddly in six months, you’ll want evidence tied to one exact build, not a guess about what was probably installed.

One warning before we move on. Only install Caddy from the official repositories or the official downloads page. A web server binary sees every request and holds your TLS private keys, so a binary copied from a random location can do anything with them. If you need extra modules, build your own binary with xcaddy instead of trusting someone else’s.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →