If we want to serve multiple subdomains on the same server the Caddyfile may look as follow:
www.example.com {
root /webspace/www
import common.conf
}
forum.example.com {
root /webspace/forum
import common.conf
}
Within the declaration of the URL we need only the parts which are only for the sub domain.
the file common.conf may look as follow:
gzip
fastcgi / /run/php/php7.0-fpm.sock php {
index index.php
}