I originally only had exampleone.com running for a while, and am changing it to run exampletwo.com as well. I’m still fairly new to both Docker and Caddy, what kind of improvements can I make? Is this a weird way of setting up the Caddyfile?
With the exception of that rogue tls command. It’s going to cause issues if you put it outside of a site block. Caddy will think you’re trying to serve a site with the labels tls and myemail@email.com and error out because those don’t look like website hostnames.
Also - currently, Caddy takes your www.exampleone.com, and splits it into two listeners: http://www.exampleone.com, which redirects to HTTPS, and https://www.exampleone.com/, which serves the site as you’ve specified (redirects to the bare domain).
That means that people visiting www over HTTP get redirected twice. You could optimise this:
Now HTTP and HTTPS visitors to www get one redirect to your main site.
On the docker side, you could probably reduce down to one volume mount: /etc/www:/srv. Then you can add or remove sites in that folder without having to much around with the Docker volumes.