I'm trying to setup Nginx config to auto redirect any domain/subdomain pointed(CNAME) to my static subdomain(site.domain.com) to a respective directory inside /var/www. The directory will be named after the pointed domain/subdomain. I don't want to use VirtualHost or alter/restart Nginx everytime someone add new domain.
I stumble upon this answer but I still don't quite understand. What should I set as root directory?
current config :
server {
server_name site.domain.com;
listen 80 default_server;
root /var/www/;
index index.html index.htm;
}