Caddy – Modern, easy-to-use and powerful Web Server

Cloud May 17, 2025

Caddy is an open-source web server written in Go that is designed to be user-friendly and efficient. It simplifies the process of setting up and deploying web services. In this article, we will explore Caddy's key features, why it is a popular choice, and how you can get started.

Features of Caddy

Introduced in 2015 by Matt Holt, Caddy was built with the philosophy of “simple but powerful”. Unlike traditional web servers like Apache or Nginx, Caddy automates many complex tasks, such as obtaining and renewing SSL/TLS certificates, saving users a lot of time and effort.

Main Features:

  • Automatic HTTPS: Caddy automatically enables HTTPS by obtaining and renewing certificates from Let’s Encrypt.
  • Easy to Configure: Caddy's configuration file is called Caddyfile, which is easy to read and write, even for beginners.
  • Good performance: Written in Go, Caddy can handle thousands of concurrent requests smoothly.
  • Scale ability: Supports plugins, allowing customization of features according to needs.

Why Caddy?

1. HTTPS automation

The most outstanding feature of Caddy is the automatic HTTPS setup. Just declare the domain, Caddy will automatically obtain and renew the SSL certificate from Let's Encrypt. This completely eliminates the complicated manual setup process, which is ideal for small projects or developers who are not deep into system administration.

2. Easy to configure with Caddyfile

Caddy uses a simple and intuitive Caddyfile. For example, to run a basic web server:

example.com {
    root * /var/www/html
    file_server
}

This configuration will serve static files in the directory /var/www/html for domain example.com, and automatically enable HTTPS.

3. Support HTTP/3

Caddy is one of the first web servers to support HTTP/3 – a new protocol that improves page load speed and performance, prioritizing user experience.

4. Flexible and scalable

Caddy provides a rich plugin system, allowing to add features such as data compression, redirection, cloud services integration. Users can download modules from the official repo or write their own modules.

Install and Use Caddy

Install

Caddy can be easily installed on Linux, macOS, Windows.
Example installation 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

Verify installation

caddy version

Run a basic web server

Create Caddyfile file with:

:80 {
    root * /var/www/html
    file_server
}

Run Caddy:

sudo caddy run --config Caddyfile

Open a browser and access http://localhost to verify.

Setting HTTPS

To enable HTTPS for your domain, simply update Caddyfile:

example.com {
    root * /var/www/html
    file_server
}

Caddy will automatically enable HTTPS and obtain an SSL certificate.

Use Cases of Caddy

  • Serving static websites: Caddy is well-suited for deploying static websites created using Hugo, Jekyll, Gatsby.
  • Reverse Proxy: Use Caddy as a reverse proxy to route requests to the backend app (Node.js, Python, PHP, …).
  • API Server: Secure and manage APIs with HTTPS and built-in security features.
  • Triển khai nhanh: For individuals or startups, Caddy allows for quick project deployment without complex configuration.

Nginx vs Apache

FeaturesCaddyNginxApache
Automatic HTTPSYesNoNo
Easy to configureVery easyMediumHard
PerformanceHighVery HighMedium
Support HTTP/3YesYes (New Version)No
Plugin/CustomizationEasyHardMedium

Caddy stands out for its simplicity and automation. Nginx is suitable for systems that need extremely high performance, while Apache is suitable for applications that need many traditional modules.

Conclude

Caddy is a great choice for anyone looking for a modern, easy-to-use, and powerful web server. With automatic HTTPS, simple configuration, and HTTP/3 support, Caddy is ideal for both personal and business projects.

If you want to deploy a website or application quickly, try Caddy today.

Get started by installing Caddy and creating your first Caddyfile – you’ll be surprised how easy and flexible it is! Tham khảo

Thanks for reading!

Tags