1. Caddy version (caddy version
):
v2.4.6
2. How I run Caddy:
Ubuntu Service
a. System environment:
Ubuntu 20
b. Command:
N/a
c. Service/unit/compose file:
d. My complete Caddyfile or JSON config:
{
email me@example.com
acme_dns cloudflare API_KEY
}
aspecthq.com {
redir https://www.aspecthq.com{uri}
}
www.aspecthq.com {
root * /var/www/aspecthq.com
log {
output file /var/log/caddy/aspecthq.com/access.log {
roll_size 3MiB
roll_keep 5
roll_keep_for 48h
}
format console
}
encode gzip zstd
php_fastcgi unix//run/php/php8.1-fpm.sock
file_server
push
}
3. The problem I’m having:
I am trying to learn the API. When I read the docs, it makes sense. However, when I look at my CaddyFile, I get confused on how I would add this data via the API.
I hope to add more domains with pretty much the exact setup minus the domain and directories (obviously).
I am open to feedback on how I could optimize settings. It seems that many of the settings could be made global. I really only need to customize the www and log folders. I am fine with everything else being the same.
4. Error messages and/or full log output:
N/a
5. What I already tried:
I queried the config on my server with this CaddyFile in order to analyze the structure. The structure seems to be all over the place and not as easily confined like the Caddyfile.
6. Links to relevant resources:
n/a