0

If request is coming from http://xxx.domain.com,

i want to be able to say;

DocumentRoot /home/${SUBDOMAIN_NAME}

so that Virtual host's DocumentRoot will be assigned to /home/xxx

Any way I can accomplish this?

Thanks, D

ps: please don't worry about security or how bad this idea is. I have over-simplified the problem for the sake of simplicity.

Real usage will be as follows:

<IfModule mpm_itk_module> AssignUserId ${SUBDOMAIN_NAME} usergroup </IfModule>

There will be a unix user with the corresponding subdomain name.

Devrim
  • 1,187

3 Answers3

2

I think what you are looking for is mass virtual hosting: http://httpd.apache.org/docs/1.3/vhosts/mass.html

Or http://httpd.apache.org/docs/1.3/mod/mod_vhost_alias.html

You probably want something like:

UseCanonicalName    Off
VirtualDocumentRoot /home/%-1

%-1 would get the subdomain.

Read the sites listed for more information.

0

Answer is provided by Jeff.

Using URL within Vhost container with mod_perl dynamically

Devrim
  • 1,187
-1
NameVirtualHost *:80

<VirtualHost *:80>
ServerName xxx.example.com
DocumentRoot /www/xxx
</VirtualHost>

<VirtualHost *:80>
ServerName yyy.example.com
DocumentRoot /www/yyy
</VirtualHost>

above is a simple example of name-based...you can also use ip based:

<VirtualHost xxx.example.com>
ServerAdmin webmaster@example.com
DocumentRoot /groups/example/xxx
ServerName xxx.example.com
ErrorLog /groups/example_xxx/logs/error_log
TransferLog /groups/example_xxxx/logs/access_log
</VirtualHost>

<VirtualHost yyy.example.com>
ServerAdmin webmaster@example.com
DocumentRoot /groups/example/yyy
ServerName yyy.example.com
ErrorLog /groups/example_yyy/logs/error_log
TransferLog /groups/example_yyy/logs/access_log
</VirtualHost>
user6373
  • 174