Best way to install Caddy on Ubuntu 20.04 LTS

What’s the best way to install Caddy on Ubuntu 20.04 LTS?

Requirements:

  • easy to start at boot (as systemd unit)
  • easy to update (preferably not have to compile it myself) to pick up security patches
  • easy to add plugins (e.g. Cloudflare DNS API for auto TLS)
  • can easily reverse proxy to other local services (some run as Docker containers, others straight up processes on the host)

I see there’s an apt repo, an official Docker image, a snap. But they all seem to have their own limitations.

1 Like

It’s right in the docs:

And if you need plugins, these instructions let you swap out the binary:

Caddy has a caddy upgrade command that will download the latest version with the same set of plugins in your current binary, then replace the binary (remember to restart your server after doing so).

1 Like

Thanks. I’m aware of the documentation but not a fan of the dpkg-divert and update-alternatives workaround to make plugins work and the fact that an apt upgrade will no longer update caddy.custom.

Any plans to remove some of this friction?

1 Like

Not really. There’s no way around it. Caddy plugins must be compiled in statically.

You can sign up for notifications when Caddy publishes a new release by clicking the Watch button on the Github repo: GitHub - caddyserver/caddy: Fast, multi-platform web server with automatic HTTPS, then just run sudo caddy upgrade after that to have it fetch a new build from Download Caddy.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.