Caddy Web server, auto HTTPS
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
caddy runcaddy startcaddy reloadcaddy stopcaddy validatecaddy fmt --overwrite
caddy file-server --browse
caddy reverse-proxy --from :80 --to :8080
Concepts
- Caddyfile human-friendly config
- JSON config native format
- Admin API localhost:2019
- Running server auto HTTPS
Run and control
caddy runcaddy startcaddy stopcaddy reloadcaddy run --config <file>
caddy run --watch
caddy versionConfig tools
caddy validate --config <file>
caddy fmt --overwrite <file>
caddy adapt --config <file>
caddy run --config <file> --adapter caddyfile
Quick servers
caddy file-server
caddy file-server --browse
caddy file-server --root <dir> --listen
:<port>
caddy file-server --access-log
caddy reverse-proxy --from <addr> --to
<backend>
caddy reverse-proxy --change-host-header --to
<url>
caddy respond --status <code>
"<body>"
Caddyfile basics
example.com { ... }
:8080 { ... }http://example.com { ... }
{ email <addr> }
reverse_proxy <backend>
file_serverroot * <dir>
encode zstd gzip
respond "<text>" <status>
redir <to> permanent
try_files {path} /index.html
handle /api/* { ... }
handle_path /api/* { ... }
header <Name> <value>
basic_auth { <user> <hash> }
log@<name> { ... }
(<name>) { ... } / import <name>
{$VAR} / {env.VAR}
Certificates and passwords
caddy trustcaddy hash-password
Recipes
# Caddyfileexample.com { root * /var/www/site encode zstd gzip try_files {path} /index.html file_server}
# Caddyfileexample.com { handle /api/* { reverse_proxy localhost:3000 } handle { root * /var/www/site file_server }}
caddy hash-password# Caddyfile: paste the hashexample.com { basic_auth { alice <hash> } reverse_proxy localhost:8080}
caddy fmt --overwrite Caddyfilecaddy validate --config Caddyfilecaddy reload --config Caddyfile



