Self Host Everything

Self Host Everything

How to set up a reverse proxy with HTTPS in less than 2 minutes with Caddy on Ubuntu

Subscribe to my newsletter and never miss my upcoming articles

Tired of nginx? Try Caddy -- a full featured web server that automatically handles HTTPS and SSL and is easily configurable.


Install Caddy

echo "deb [trusted=yes] /" \
    | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
sudo apt update
sudo apt install caddy

Install Caddy via the apt package manager Here's what these commands do:

  1. Add the Caddy source to your local package registry
  2. Pull in the new packages
  3. Install Caddy

Setup Caddy

This is painfully easy. When you installed Caddy it was automatically added as a service, all you need to do is edit the configuration file located at /etc/caddy/Caddyfile . Open it with your favourite text editor and paste the following:


Substitute for – well – your domain (don't forget to add a DNS record pointing to your server) and 8000 for the port you want to reverse proxy requests to.

Restart the Caddy service with sudo systemctl restart caddy and Caddy will automatically issue a SSL certificate for your domain via Let's Encrypt and activate HTTPS – no more configuration required.

Extra: If you want to add multiple domains

Just change the Caddyfile to the following and restart the service: {


} {



Extra: More configuration options

There are a lot more directives (that's what the reverse_proxy part is called). If you're curious what else Caddy can do (it's a full featured web server – e.g. a lot) check out their brilliant documentation.

Share this