1. My Caddy version (
2. How I run Caddy:
a. System environment:
c. Service/unit/compose file:
Description=Caddy Web Server
ExecStart=/usr/bin/caddy run --config /etc/caddy/Caddyfile --adapter caddyfile --resume --environ
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --adapter caddyfile
d. My complete Caddyfile or JSON config:
root * /var/lib/caddy/domain1.com
output file /var/log/caddy/domain1.com
root * /var/lib/caddy/domain2.com
output file /var/log/caddy/domain2.com
root * /var/lib/caddy/www.domain3.com
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
-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
$ grep domain3.com /var/log/caddy/domain2.com | wc -l
$ grep domain3.com /var/log/caddy/www.domain3.com | wc -l
I am not able to reproduce that behavior. I set those domains in my hosts file to point to localhost and then used your Caddyfile verbatim and the logs are going to their proper files, as expected.
Can you please post the contents of each of the log files? (And please don’t redact, we have rules about this for good reason – doesn’t matter who owns the domain names. If you want us to be helpful we need the already-public information to not be redacted, please.)
As another suggestion, try running Caddy manually without the service file or any of the unnecessary flags to make sure that’s not getting in the way.
Edit: Someone else recently posted about a similar issue, but I have been unable to reproduce that problem as well… hmm. (Edit: I’ve since been able to reproduce it, but it was likely a different issue – impossible to know for sure without your complete and unredacted Caddyfile.)
I’ve tried starting over with a new Caddyfile and changing everything to to my own domains - and I couldn’t reproduce it either. In the process, I deleted the autosave.json file.
When I switched back to the old Caddyfile, everything worked as expected. Maybe deleting this json file solved the problem? Sadly, I didn’t keep a copy of the old file.
So it sounds like you’re running Caddy wrong for what you need – try removing the
Right, but do you know what it means/does?
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.