How to install Caddy on your Ubuntu server

Sam

Code for this tutorial can be found on GitHub

Why Caddy?

Let's take a quick look at why we might want to use Caddy over something else like NGINX.

  1. Automatic HTTPS, meaning no fiddling with Certbot anymore
  2. Simple syntax
  3. Easy to configure

But enough of why we might want to use Caddy, let's get started on how to install it on your Ubuntu Server.

Install

So you have an Ubuntu server which you can access via SSH and you have a user with sudo permissions. If you don't have one you can get one from us at Vizalo from as little as $8 per month.

Once you've connected to your server you will need to run the following commands:

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

You'll be prompted to enter y to proceed, once you've done that you should be able to run - sudo systemctl status caddy and see some nice output confirming that Caddy is up and running.

Done

That's it, you've successfully installed Caddy! Well done! In a future tutorial we will take a look at some common Caddyfile configurations for running your apps.

Table of Contents