Caddy#
Let’s Encrypt integrated (no need for certbot any more)
caddyfile#
Example Caddyfile
with some snippet definitions for reusability
and usage examples via import.
{
# debug
}
(log_and_errors) {
log {
output file /var/log/caddy/{args.0}.json
}
handle_errors {
header Content-Type text/plain
respond "{http.error.status_code} {http.error.status_text}"
}
}
(static) {
{args.0}:443 {
import log_and_errors {args.0}
root * {args.1}
file_server
}
}
(redirect) {
{args.0}:443 {
redir {args.1}
}
}
(proxy) {
{args.0}:443 {
import log_and_errors {args.0}
reverse_proxy {args.1}
}
}
(proxy_basic_auth) {
{args.0}:443 {
import log_and_errors {args.0}
basicauth {
alice PASSWORD_SEE_GENERATION_BELOW
}
reverse_proxy {args.1}
}
}
import static blog.example.com /var/www/felixhummel.de/blag
import proxy www.example.com http://some-upstream:13370
import proxy_basic_auth secret.example.com http://another-upstream
passwords#
Password generation:
caddy hash-password
Bash Heredocs
0-main.de