Setting root based on Host: header
Maxim Dounin
mdounin at mdounin.ru
Mon Oct 20 01:38:47 MSD 2008
Hello!
On Sun, Oct 19, 2008 at 11:00:06PM +0200, Samuel Vogel wrote:
> Hey guys,
>
> Could somebody tell me how I would set the "root"-Variable based up on
> the contents of the Host: Header?
> I have a host header like this: 345232.user.domain.net
>
> I would like to construct a root like this: /www/345232
Something like:
set $subdir "default";
if ($host ~ "^(.+)\.user\.domain\.net$") {
set $subdir $1;
}
root /www/$subdir;
should work.
Maxim Dounin
More information about the nginx
mailing list