I read in another post about how to define an alias (aka apache/nginx) in Caddy. For example:
example.com {
root /var/www/html
...
}
example.com/path/ {
root /some/other/path
....
}
This seems straight forward…
But what if I serve many domains? I am not certain about the syntax. I currently have:
https:// {
tls {
on_demand
}
encode zstd gzip
file_server
root * /home/jimcook/mpa/custom/{host}
php_fastcgi unix//run/php/php8.1-fpm.sock
log {
output file /home/jimcook/log/caddy.json
format json
}
}
What I am trying to do is serve files, but if they have a specific path, /common7 in my case, serve those out of a different directory that is the same across all the domains.
So in the example above, I would want a site abc.com to serve files out of /home/jimcook/mpa/custom/abc.com and that works, but if they specify abc.com/common7
I want to get them to serve out of a different directory and I can’t figure out the proper syntax… it seems that using https:///common7 would be odd looking, but is that correct?
p.s. I am in the process of retiring my last apache2 server and replacing it with Caddy. Caddy rocks!