AI Crawler · Collection Records

Bot summary · Last 24 hours

caddy — automatic HTTPS web server

Issues and renews automatic HTTPS (Let's Encrypt) certificates with a single line of configuration. Simpler to configure compared to nginx.
Markdown source·Anything to add or correct?

💬 "caddy Command"

caddy automatically issues and renews HTTPS (Let's Encrypt) certificates with a single line of configuration for an automatic HTTPS web server. Compared to nginx, its configuration is simpler.

It supports automatic HTTPS certificate issuance and renewal with a single line per domain. It uses two configuration formats: JSON and Caddyfile.

  • Concept: Supports automatic HTTPS certificate issuance and renewal with a single line per domain.
  • Key Features: Uses two configuration formats: JSON and Caddyfile.
  • Advantages: Natively supports HTTP/3 (QUIC).
  • Usage: Built-in support for static files, reverse proxy, and FastCGI.

Installation and Download

caddy can be installed via a package manager or an official script.

EnvironmentCommand
Ubuntu / Debiansudo apt install caddy
Official Scriptcurl https://caddyserver.com/api/download?os=linux
macOS (brew)brew install caddy
Dockerdocker run -p 80:80 -p 443:443 caddy
Verificationcaddy version

Verify the installation with caddy --version.

Frequently Used Options

OptionDescription
caddy runRun in foreground
caddy startRun in background
caddy reloadReload configuration (zero downtime)
caddy validateValidate configuration syntax
sudo systemctl reload caddyReload service

Three Essential Command Combinations

  • caddy run — Load Caddyfile and run in foreground
  • caddy validate --config /etc/caddy/Caddyfile — Validate configuration
  • sudo systemctl reload caddy — Zero-downtime reload

💬 "Show an example of using caddy on a real server"

Here are common situations encountered on a real server, organized step by step.

Step 1 · Installation Verification

Check if it's installed.


caddy version || sudo apt install -y caddy

Step 2 · Configuration Writing

Write the Caddyfile.


echo 'example.com {\n    root * /var/www/html\n    file_server\n}' > /etc/caddy/Caddyfile

Step 3 · Start

Start caddy and verify.


sudo systemctl restart caddy && curl -sI https://example.com/

Actual Execution Screen

Result of writing the Caddyfile and validating the configuration.

!caddy command execution result

Real server in operation

In Practice, It Is Used Like This

1. Migrating from nginx to Caddy

Situation — Migrate nginx 443 block to a Caddyfile.


echo 'example.com {\n    root * /var/www/html\n    file_server\n    encode gzip\n}' > /etc/caddy/Caddyfile

Result — Configuration is complete with a single Caddyfile.

Key Points — No need for separate certbot cron or additional settings.

2. Verifying Automatic HTTPS

Situation — Verify automatic certificate issuance.


sudo systemctl restart caddy && sleep 5 && curl -sI https://example.com/

Result — HTTP/2 200 and server: Caddy are visible.

Key Points — Automatic HTTPS works in the browser.

Actual Execution Screen

Result of confirming that automatic HTTPS works after starting caddy.

!caddy command execution result 2

Real server in operation

Points to Note

  • If the site address in the Caddyfile does not specify a port, it defaults to 80/443. Be cautious of port conflicts.
  • Automatic HTTPS only works if the domain actually points to the caddy server. Certificate issuance will fail if DNS is not configured.
  • When switching from nginx to Caddy, nginx-specific modules (e.g., Lua) may not have alternative implementations.

Source (HTML): https://games.aidebatehub.com/programs/linux/webserver/caddy.html This file is an auto-generated Markdown twin of the DevHub document.

Visitor Comments

Loading…
💬 Comments: 0 · Author type: human | Built: 2026-10-30T20:30:58+09:00