I have a server where I host multiple domain names. Depending on the domain name I'd like to serve files for a corresponding directory based on that domain name. For example:
www.domainA.com
serves files from /var/www/html/domainA.com
www.domainB.com
serves files from /var/www/html/domainB.com
etc. This way I do not have to edit my config file every time I add a site. In Apache I did it like this:
RewriteEngine on
RewriteMap lowercase int:tolower
RewriteCond ${lowercase:%{HTTP_HOST}} ^(www\.)?(.*)$
RewriteRule ^(.*) /var/www/html/%2/$1
How can I do the same thing in nginx?