1. Caddy version (caddy version
):
v2.3.0 h1:fnrqJLa3G5vfxcxmOH/+kJOcunPLhSBnjgIvjXV/QTA=
2. How I run Caddy:
a. System environment:
Unix - Debian
b. Command:
caddy start
c. Service/unit/compose file:
paste full file contents here
d. My complete Caddyfile or JSON config:
ma4b.com {
root * /home/jimcook/ma4b/builder
encode zstd gzip
file_server
php_fastcgi unix//run/php/php7.3-fpm.sock
}
builder.ma4b.com {
root * /home/jimcook/ma4b/builder
encode zstd gzip
file_server {
index sb.php
}
php_fastcgi unix//run/php/php7.3-fpm.sock
log {
output file /home/jimcook/ma4b/logs/builder_access.log
}
}
web.ma4b.com {
root * /home/jimcook/ma4b/websites
encode zstd gzip
file_server {
index index.html
}
php_fastcgi unix//run/php/php7.3-fpm.sock
log {
output file /home/jimcook/ma4b/logs/web_access.log
}
}
new.ma4b.com {
root * /home/jimcook/ma4b/websites/x5af/aw13
encode zstd gzip
file_server {
index index.html
}
php_fastcgi unix//run/php/php7.3-fpm.sock
log {
output file /home/jimcook/ma4b/logs/web_access.log
}
}
3. The problem I’m having:
(1) I feel like I am missing something as I think what I am trying to do should be simple. I simply want to dynamically add new domains with specific roots to my server using the caddy api and I am having a terrible time trying to figure out how to do it so I think I am not seeing the forest from the trees.
In the caddy file above, the last domain, new.ma4b.com is the pattern I want to add where the domain is anything new and the root will have a unique path. For example, adding a new domain xyz.com and a root path /home/ma4b/websites/a234/b324 . The other entries, encode, file_server, etc… are the same across all new entries.
(2) Is there a way to global those static entries like encode, file_server, etc… without having to specify them each time?
4. Error messages and/or full log output:
No error message… just don’t know where to start.
5. What I already tried:
I looked at the api command and when I have it display the config, it is a convoluted set of parameters and it seems like it would be crazy to have to specify all of those things in the API when it is so simple to add with the caddy file. Am I missing something?
6. Links to relevant resources:
None