Since wildcards and labels only cover one domain element, you’ll need to make one catch-all site for each length of FQDN you expect to handle.
Also, root doesn’t accept a placeholder. It looks like your folders are structured underneath the site root already, which is good. You’ll need to rewrite to append the folder name based off each domain.
Here’s an example:
(common) {
root /app/site
gzip
log / stdout "{proto} Request: {method} {path} {label1}"
}
http://*.*.demo.local {
import common
rewrite {
to /{label1}.{label2}{uri}
}
}
http://*.demo.local {
import common
rewrite {
to /{label1}{uri}
}
}
Specifically, if you need this behaviour in particular:
Then you’d use something like this:
(common) {
root /app/site
gzip
log / stdout "{proto} Request: {method} {path} {label1}"
}
http://*.*.*/demo.local {
import common
rewrite {
to /{label1}.{label2}.{label3}{uri}
}
}
http://*.*/demo.local {
import common
rewrite {
to /{label1}.{label2}{uri}
}
}