Tools: Installing Caddy Web Server on Ubuntu 26.04 - Full Analysis

Tools: Installing Caddy Web Server on Ubuntu 26.04 - Full Analysis

Install Caddy

Configure Caddy as a System Service

Configure Firewall Rules

Create a Virtual Host

Validate and Reload

Next Steps Caddy is an open-source web server written in Go that automatically provisions and renews HTTPS certificates from Let's Encrypt without any manual configuration. Unlike Apache or Nginx, Caddy makes HTTPS the default and handles certificate management entirely on its own. This guide installs Caddy on Ubuntu 26.04 from the official repository, configures a virtual host with automatic SSL, and verifies the setup. By the end, you'll have Caddy serving your domain over HTTPS with no manual certificate management required. Caddy provides an official APT repository for Debian-based systems. 1. Update the APT package index: 2. Add the Caddy GPG key: 3. Add the Caddy APT repository: 4. Refresh APT and install Caddy: 5. Verify the installed version: Enable Caddy to start automatically when the server boots. 1. Enable and start the service: 2. Check the service status: 3. Stop or restart the service when needed: Port 80 is required for ACME certificate challenges. 1. Create the web root directory and set permissions: 2. Create a sample HTML page: 3. Create the log directory: 4. Back up the default Caddyfile: 5. Create a new Caddyfile: Directives explained: 1. Format the Caddyfile: 2. Validate the configuration: Open https://app.example.com in a browser. The page loads with a valid SSL certificate — no extra steps required. Caddy is now running and serving your domain over HTTPS. From here you can: For the full guide with additional tips, visit the original article on Vultr Docs. Templates let you quickly answer FAQs or store snippets for re-use. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Command

Copy

$ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 500;">curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | -weight: 600;">sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg $ -weight: 500;">curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | -weight: 600;">sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg $ -weight: 500;">curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | -weight: 600;">sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg $ -weight: 500;">curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | -weight: 600;">sudo tee /etc/-weight: 500;">apt/sources.list.d/caddy-stable.list $ -weight: 500;">curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | -weight: 600;">sudo tee /etc/-weight: 500;">apt/sources.list.d/caddy-stable.list $ -weight: 500;">curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | -weight: 600;">sudo tee /etc/-weight: 500;">apt/sources.list.d/caddy-stable.list $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install caddy -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install caddy -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install caddy -y $ caddy version $ caddy version $ caddy version $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">stop caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">stop caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">stop caddy $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart caddy $ -weight: 600;">sudo ufw allow 80/tcp $ -weight: 600;">sudo ufw allow 443/tcp $ -weight: 600;">sudo ufw allow 80/tcp $ -weight: 600;">sudo ufw allow 443/tcp $ -weight: 600;">sudo ufw allow 80/tcp $ -weight: 600;">sudo ufw allow 443/tcp $ -weight: 600;">sudo mkdir -p /var/www/app.example.com $ -weight: 600;">sudo chown -R caddy:caddy /var/www/app.example.com $ -weight: 600;">sudo mkdir -p /var/www/app.example.com $ -weight: 600;">sudo chown -R caddy:caddy /var/www/app.example.com $ -weight: 600;">sudo mkdir -p /var/www/app.example.com $ -weight: 600;">sudo chown -R caddy:caddy /var/www/app.example.com $ -weight: 600;">sudo nano /var/www/app.example.com/index.html $ -weight: 600;">sudo nano /var/www/app.example.com/index.html $ -weight: 600;">sudo nano /var/www/app.example.com/index.html <!DOCTYPE html> <html> <head><title>My App</title></head> <body><h1>Hello World from Caddy on Ubuntu 26.04</h1></body> </html> <!DOCTYPE html> <html> <head><title>My App</title></head> <body><h1>Hello World from Caddy on Ubuntu 26.04</h1></body> </html> <!DOCTYPE html> <html> <head><title>My App</title></head> <body><h1>Hello World from Caddy on Ubuntu 26.04</h1></body> </html> $ -weight: 600;">sudo mkdir -p /var/log/caddy $ -weight: 600;">sudo chown -R caddy:caddy /var/log/caddy $ -weight: 600;">sudo mkdir -p /var/log/caddy $ -weight: 600;">sudo chown -R caddy:caddy /var/log/caddy $ -weight: 600;">sudo mkdir -p /var/log/caddy $ -weight: 600;">sudo chown -R caddy:caddy /var/log/caddy $ -weight: 600;">sudo mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.default $ -weight: 600;">sudo mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.default $ -weight: 600;">sudo mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.default $ -weight: 600;">sudo nano /etc/caddy/Caddyfile $ -weight: 600;">sudo nano /etc/caddy/Caddyfile $ -weight: 600;">sudo nano /etc/caddy/Caddyfile app.example.com { tls [email protected] root * /var/www/app.example.com file_server { index index.html } log { output file /var/log/caddy/app.example.com.log format console } } app.example.com { tls [email protected] root * /var/www/app.example.com file_server { index index.html } log { output file /var/log/caddy/app.example.com.log format console } } app.example.com { tls [email protected] root * /var/www/app.example.com file_server { index index.html } log { output file /var/log/caddy/app.example.com.log format console } } $ -weight: 600;">sudo caddy fmt --overwrite /etc/caddy/Caddyfile $ -weight: 600;">sudo caddy fmt --overwrite /etc/caddy/Caddyfile $ -weight: 600;">sudo caddy fmt --overwrite /etc/caddy/Caddyfile $ -weight: 600;">sudo caddy validate --config /etc/caddy/Caddyfile $ -weight: 600;">sudo caddy validate --config /etc/caddy/Caddyfile $ -weight: 600;">sudo caddy validate --config /etc/caddy/Caddyfile $ -weight: 600;">sudo -weight: 500;">systemctl reload caddy $ -weight: 600;">sudo -weight: 500;">systemctl reload caddy $ -weight: 600;">sudo -weight: 500;">systemctl reload caddy - tls: email address for Let's Encrypt registration - root: document root directory - file_server: enables static file serving - log: routes access logs to a file - Configure Caddy as a reverse proxy in front of a Node.js or Python application - Add multiple sites by appending additional server blocks to the Caddyfile - Enable automatic HTTP-to-HTTPS redirects — Caddy enables them by default