Forum: NGINX Setting root based on Host: header

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
01ac0a21625f83cb6893c7d755eec9e0?d=identicon&s=25 Samuel Vogel (Guest)
on 2008-10-19 23:12
(Received via mailing list)
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

Thanks,
Samy
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2008-10-19 23:45
(Received via mailing list)
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
01ac0a21625f83cb6893c7d755eec9e0?d=identicon&s=25 Samuel Vogel (Guest)
on 2008-10-20 16:08
(Received via mailing list)
Am 19.10.2008 23:38 Uhr, Maxim Dounin schrieb:
> should work
Thanks!

Regards,
Samy
This topic is locked and can not be replied to.