Skip to content

Caddy on a VPS

Web server with auto HTTPS

Category
Dev / Tools
Author
Caddy (ZeroSSL)
License
Apache-2.0
Version
2.11.4

The script is free · VPS from $2.79 per month · installs in about 45 seconds

Install over SSH

root@vps:~# 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 chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg /etc/apt/sources.list.d/caddy-stable.list && sudo apt update && sudo apt install -y caddy

  • SystemUbuntu 24.04 · x86_64ok
  • Sourcegithub.com/caddyserver/caddyok
  • Version2.11.4ok
  • Port80/tcplisten
  • Port443/tcp/udplisten

✓ Caddy 2.11.4 installed · about 45 seconds

root@vps:~#

Install command from the library. Output is shortened and may differ on your server.

What it is

  • Web server
  • HTTPS
  • Reverse proxy

Caddy is a web server and reverse proxy that obtains and renews HTTPS certificates on its own. Just put your domain in the config and the site works over HTTPS right away.

A Caddyfile is shorter and simpler than an Nginx config: proxying an app on port 3000 takes two lines. That's why Caddy is often placed in front of Vaultwarden, n8n, panels and webhook bots.

The command adds the official Caddy repository and installs it as a systemd service.

  • Automatic HTTPS via Let's Encrypt and ZeroSSL
  • Reverse proxy in a couple of lines
  • HTTP/2 and HTTP/3
  • Static file serving
  • Zero-downtime config reload

Recommended plan

For Caddy: at least 1 vCPU, 2 GB RAM and 10 GB NVMe.

Minimum to run
1 vCPU · 1 GB RAM · 10 GB disk
Systems
Ubuntu 22.04 · Ubuntu 24.04 · Debian 11 · Debian 12

How to install

Three steps in the bot or one command over SSH; installation takes about 45 seconds.

  1. 01

    Choose a plan in the bot

    Open @ExpressHost_bot and pay for a VPS. The server will be ready in about 60 seconds.

  2. 02

    Add Caddy

    At the “Add-ons” step pick the script from the library, or run it later: Server settings → Scripts.

  3. 03

    Point your domain's A record at the server IP

    The bot will send the server address and login details to the chat.

Manually over SSH

Connect to the server as root and run the command. Supported systems: Ubuntu 22.04, Ubuntu 24.04, Debian 11, Debian 12.

Install command
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 chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg /etc/apt/sources.list.d/caddy-stable.list && sudo apt update && sudo apt install -y caddy

Ports

Caddy ports
PortProtocolPurpose
80tcpHTTP and domain validation
443tcp/udpHTTPS and HTTP/3

After installation

  1. 1.Point your domain's A record at the server IP
  2. 2.In /etc/caddy/Caddyfile add: your-domain { reverse_proxy 127.0.0.1:3000 }
  3. 3.Apply the config with systemctl reload caddy and the certificate will be issued automatically

Caddy FAQ

Didn’t find an answer? Message @ExpressHost_SupportBot.

Caddy or Nginx?

Caddy is simpler and handles HTTPS itself. Nginx is more flexible and more familiar for complex configs. For proxying a couple of services, Caddy is more convenient.

How do I update Caddy?

apt update && apt upgrade: the Caddy repository is added during installation.

Where are the config and certificates?

Config in /etc/caddy/Caddyfile, certificates in /var/lib/caddy/.local/share/caddy.

Caddy installs at checkout — in the bot.