Download Caddy

https://caddyserver.com/download

Configuration

chmod +x caddy
mv caddy /usr/bin

Systemd configuration

vim /etc/systemd/system/caddy.service
-----
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
 
[Service]
Type=notify
User=root
Group=root
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
 
[Install]
WantedBy=multi-user.target
-----
 
systemctl daemon-reload
systemctl enable --now caddy.service

Json logs format

tail -f -n 20 /var/log/caddy/your-domain.log | jq -j '.ts |= strftime("%Y-%m-%d %H:%M:%S") | .ts, " | ", .request.remote_ip," | ", .request.uri," | ", .request.method," | ", .request.proto," | ", .status," | ", .request.headers."User-Agent"[]+"\n"'