Caddy Data and Configuration Directories

1. My Caddy version (caddy version):

v2.0.0-rc.3 h1:z2H/QnaRscip6aZJxwTbghu3zhC88Vo8l/K57WUce4Q=

2. How I run Caddy:

a. System environment:

Running on CentOS 7 using systemd.

b. Command:

systemctl start caddy

c. Service/unit/compose file:

[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target

[Service]
User=www-data
Group=www-data
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/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:

{
    acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
    storage file_system {
        root /var/lib/caddy
    }
}

example.org {
    root * /var/www/public
    file_server
    encode zstd gzip
}

3. The problem I’m having:

It’s the first time I’m working with Caddy, and while my overall experience was really :100:, I stumbled over one thing:

I set the storage root to /var/lib/caddy expecting Caddy to store everything in this directory, including autosave.json. That doesn’t seem to be the case though – while certificates etc. are stored in /var/lib/caddy, autosave.json is stored in $HOME/.config/caddy.

Just wanted to check wether this actually is the expected behavior. If so, I think clarifying this (e.g. here and/or here) might help – even though the docs are probably accurate if you read carefully. Happy to send a PR (if that’s the best way to propose changes to the docs?)

4. Error messages and/or full log output:

-/-

5. What I already tried:

-/-

6. Links to relevant resources:

-/-

1 Like

Welcome @tillprochaska!

Good question. Yes, that’s expected: the config directory is for configuration, and the data directory is for data. So when Caddy stores configuration, it goes into the config directory.

I will update the docs to make it clear that updating the storage root only affects the data dir! Thanks!

Hi @matt!

Thank you so much for your quick reply! And congrats on the v2 launch and of course thanks for the continued work you and all the other contributors put into it. Can’t wait to finally use it instead of Apache and nginx.

I have a small personal list with a few small things I learned about Caddy, some of them which I think would have been helpful if they were pointed out more clearly in the docs or referenced in other places as well.

I read you and other contributors are and will be working on further improving the docs now – and am still wondering what would be the best way to either add to that effort or to provide feedback. Adding issues or creating PRs on github.com/caddyserver/website? Here in the “Site Feedback” section?

If they’re actionable items, then feel free to create an issue on that repo, yes. Just list the things you want improved and we can discuss it there. For little things like typos, feel free to submit a PR.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.