How to serve subdomain from subfolder of the domain root?

etrader nginx-forum at nginx.us
Sat Sep 14 05:42:49 UTC 2013


In a server as

server {
server_name domain.com *.domain.com
root  /var/www/$server_name;
}

is it possible to set locations for subdomains based on subfolders of the
$server_name ?

location matching sub1.domain.com {
serving from /var/www/$server_name/sub1
}


Currently, I am using a server for each subdomain, but when the number of
subdomains increases, maintaining numerous servers becomes messy.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,242841,242841#msg-242841



More information about the nginx mailing list