Welcome! Log In Create A New Profile

Advanced

Store part of subdomain in a variable to use as root

August 06, 2009 02:24AM
I need to store part of a subdomain in a variable in order to use it as my root and I can't seem to get it to work.

The URLs would be formed like: martin_branch.dev.testsite.com

And I need root to be /home/martin/martin_branch.dev.testsite.com

The underscore ("_") and stuff afterwards is optional. I'll also need martin.dev.testsite.com to have its root as /home/martin/martin.dev.testsite.com.

Note that the name ("martin") and home folder will vary.

This is what I've got so far:

server {
listen 80;
server_name ~^(.+)_*\.dev\.testsite\.com$;
set $myroot $1;
root /home/$myroot/$host;
}

Thanks in advance!
Subject Author Posted

Store part of subdomain in a variable to use as root

martinc6 August 06, 2009 02:24AM

Re: Store part of subdomain in a variable to use as root

Igor Sysoev August 06, 2009 02:40AM

Re: Store part of subdomain in a variable to use as root

martinc6 August 06, 2009 03:09PM

Re: Store part of subdomain in a variable to use as root

martinc6 August 06, 2009 03:54PM

Re: Store part of subdomain in a variable to use as root

Martin Schut August 06, 2009 04:57PM

Re: Store part of subdomain in a variable to use as root

martinc6 August 07, 2009 12:01AM

Re: Store part of subdomain in a variable to use as root

martinc6 August 07, 2009 02:27AM

Re: Store part of subdomain in a variable to use as root

Igor Sysoev August 07, 2009 04:32AM

Re: Store part of subdomain in a variable to use as root

Martin Schut August 07, 2009 11:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 235
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready