More subdomain mapping (dynamic 'root'?)
miradev
nginx-forum at nginx.us
Wed Jul 1 14:23:12 MSD 2009
I want to be able to map submains and urls to determined locations on disk, if they exist.
The URL structure is something like: http://.admin.domain.com/
Where would letters, numbers and underscores , and is a domain name (e.g. http://cnn.admin.domain.com/www.cnnminiblog.com)
Nginx should check if /var/www/clients//admin//html/ exists and use that as root:
Some horrible pseudo code:
server {
listen localhost: 80;
server_name *.admin.domain.com;
if ($host ~ (*).admin.domain.com) {
set $client = $1;
if ($url ~ ^([^/]*)) {
set $project = $1;
set $myroot = /var/www/clients/$client/admin/$project/html;
if ( -e $myroot ){
root $myroot;
}
}
}
...
}
If this is not very 'nginxy', I am very open to alternate solutions.
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,3586,3586#msg-3586
More information about the nginx
mailing list