Even though you should generally use a CDN for something like this, a very simple setup for smaller static websites on a VPS / VM is fine.
This gist comes with an example Caddyfile
that can be used with caddy to serve any sub-folder in the /var/www
path as a subdomain.
This reduces the overall effort required to create and register domains if you are going to keep it all on the same server.
The example Caddyfile
shows how to set the flow up with the localhost
domain but changing it to work with an actual domain should be rather simple and is documented as comments in the file.