1. My Caddy version (caddy version
):
v2.0.0-beta.20 h1:oUNG1uh0UV8LWLlAVDZolFzk112++V/pxY+fF0HLmlY=
2. How I run Caddy:
systemd
a. System environment:
Ubuntu 18.04.4
c. Service/unit/compose file:
[Unit]
Description=Caddy Web Server
Documentation=https://caddyserver.com/docs/
After=network.target
[Service]
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --config /etc/caddy/Caddyfile --adapter caddyfile --resume --environ
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --adapter caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
d. My complete Caddyfile or JSON config:
domain1.com {
root * /var/lib/caddy/domain1.com
file_server
log {
output file /var/log/caddy/domain1.com
}
}
domain2.com {
root * /var/lib/caddy/domain2.com
file_server
log {
output file /var/log/caddy/domain2.com
}
}
www.domain2.com {
redir https://domain2.com{uri}
}
domain3.com {
redir https://www.domain3.com{uri}
}
www.domain3.com {
root * /var/lib/caddy/www.domain3.com
file_server
log {
output file /var/log/caddy/www.domain3.com
}
}
(had to retract the domain names as they don’t belong to me)
3. The problem I’m having:
All requests end up being logged in all logfiles
$ ls -l /var/log/caddy
total 30224
-rw-r--r-- 1 caddy caddy 10307648 Mar 29 08:51 domain1.com
-rw-r--r-- 1 caddy caddy 10307648 Mar 29 08:51 domain2.com
-rw-r--r-- 1 caddy caddy 10307648 Mar 29 08:51 www.domain3.com
$ grep domain3.com /var/log/caddy/domain1.com | wc -l
258
$ grep domain3.com /var/log/caddy/domain2.com | wc -l
258
$ grep domain3.com /var/log/caddy/www.domain3.com | wc -l
258
$