Caddy is a powerful, enterprise-ready web server with automatic HTTPS. Its simple configuration and built-in Let’s Encrypt support make it the easiest web server to deploy securely.
📑 Table of Contents
Key Features
- Automatic HTTPS: Built-in certificate management
- Caddyfile: Human-readable configuration
- HTTP/3: Modern protocol support
- Reverse Proxy: Advanced proxying capabilities
- Zero Downtime: Graceful configuration reloads
Installation
Install Caddy on Ubuntu:
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
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
Usage Examples
Caddyfile configuration:
# Basic static site
example.com {
root * /var/www/html
file_server
}
# Reverse proxy
api.example.com {
reverse_proxy localhost:3000
}
# PHP site
php.example.com {
root * /var/www/php
php_fastcgi unix//run/php/php-fpm.sock
file_server
}
Benefits
Caddy eliminates SSL complexity with automatic certificate management. Its modern design and sensible defaults reduce configuration while improving security.
Was this article helpful?