How should I set my nginx configuration to use subdomains with CNAME host record?

running Debian 11.

How should I add my subdomain to my site using my CNAME DNS records? My website directory is located at /var/www/ and I’m wondering if I can make a subdirectory for the subdomain within that directory.

i.e. /var/www/domain-dir/subdomain-dir

Can I add subdomain server_name to right in my sites-available config file?

I don’t want to create tons of A/AAAA records to point to my subdomain as it could become messy as I’ll likely create more subdomains later, blog.example.com, git.example.com, etc..

Sorry if this post is long, I’m new to this and don’t know how to make it more concise!