Assign a Caddyfile for each domain

How to assign a Caddyfile for each domain?
I have a big number of domains in one server. Every domain is uniquely configured. thanks

Hi @nudylady, welcome to the Caddy community.

A single Caddyfile can hold multiple site definitions. See the Caddyfile documentation for more details.

If you’re looking to use one Caddyfile per site, you’ll be interested in the import directive, which you can use globs on. I do this myself - I usually only have import /etc/Caddyfiles/*.caddyfile in my Caddyfile, and then place files in there named after the site label, e.g.

1 Like

Yes. I sorted out finally. thanks for help.
I will see whether the server will be slower if there are 100 caddyfiles.

I don’t think it will be, 100 isn’t a huge number. You’ll see slowdowns faster with non-SSD storage, of course, but I believe we’ve seen Caddy users with tens of thousands of domains.


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