1. The problem I’m having:
Currently at my job, we have one Caddyfile for our reverse proxy, as well as a Caddyfile for the application servers. We support many domains from multiple customers. With more customers coming in, it is now becoming hard to maintain so many domains.
I’ve attached example Caddyfile of both reverse proxy and application servers. I’m just wondering if this is the correct way, of there is a best practice around this.
2. Error messages and/or full log output:
No errors.
3. Caddy version:
v2.8.4
4. How I installed and ran Caddy:
Running binaries from github
a. System environment:
Debian 12
b. Command:
No special command.
c. Service/unit/compose file:
No special unit.
d. My complete Caddy config:
example.com, another.com, more.com, simple.com, customer.com, beta.customer.com, anotherexample.com, morexamples.com, supernice.com, amazing.com, thisisterrible.com {
tls {
dns cloudflare EXAMPLE_KEY
}
reverse_proxy node1:80 node2:80 node3:80
}
And then, inside the application servers (node1, node2, node3), looks like this:
specific.com, another.com, beta.customer.com {
root * /sites/normal/public
encode gzip
php_fastcgi unix//var/run/php/php-fpm.sock {
env THEME "default-dark"
capture_stderr
}
}
example.com, more.com, simple.com, customer.com, anotherexample.com, morexamples.com, supernice.com, amazing.com, thisisterrible.com {
root * /sites/beta/public
encode gzip
php_fastcgi unix//var/run/php/php-fpm.sock {
env THEME "beta"
capture_stderr
}
}
5. Links to relevant resources:
No links.