You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by James Davis <ja...@freecharity.org.uk> on 2007/04/24 18:38:34 UTC

[users@httpd] Combinging static virtual hosts and dynamic VirtualDocumentRoot hosts

Running Debian Etch's Apache/2.2.3

I'd like to be able to setup virtual hosts, accessed via subdomains of
freecharity.org.uk for my users. So instead of
http://www.freecharity.org.uk/~james/ they'll be using
http://james.freecharity.org.uk/.

I already have some, statically defined, virtual hosts on subdomains of
freecharity.org.uk, for example webmail.freecharity.org.uk. My
configuration so far reads something like...

NameVirtualHost *
<VirtualHost *>
	ServerName www.freecharity.org.uk
        DocumentRoot /var/www/main/
	...
</VirtualHost>
... numerous other virtual hosts ...
<VirtualHost *>
        VirtualDocumentRoot /home/%1/public_html/
</VirtualHost>

However, james.freecharity.org.uk is serving pages from /var/www/main/
instead of /home/james/public_html/. If I place the VirtualDocumentRoot
statement outside of the VirtualHost it swallows up requests for defined
virtual hosts (tries to serve www.freecharity.org.uk from /home/www for
example).

Any suggestions as to how I should VirtualDocumentRoot to play nicely
with static virtual hosts?

Thanks,

James

-- 
http://www.freecharity.org.uk/ - Free IT services for charities
http://www.freecharity.org.uk/wiki/ - The VCSWiki

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Combinging static virtual hosts and dynamic VirtualDocumentRoot hosts

Posted by James Davis <ja...@freecharity.org.uk>.
Joshua Slive wrote:

> ServerAlias *.freecharity.org.uk
> in the last <VirtualHost>

That almost did the trick. www. was being served from /var/www/main and
james. from /home/james/public_html/ although some other predefined
subdomains weren't working.

Making sure that this last VirtualHost definition was the last defined
VirtualHost appears to have done the trick though :-)

Thank you,

James

-- 
http://www.freecharity.org.uk/ - Free IT services for charities
http://www.freecharity.org.uk/wiki/ - The VCSWiki

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Combinging static virtual hosts and dynamic VirtualDocumentRoot hosts

Posted by Joshua Slive <jo...@slive.ca>.
On 4/24/07, James Davis <ja...@freecharity.org.uk> wrote:
> Running Debian Etch's Apache/2.2.3
>
> I'd like to be able to setup virtual hosts, accessed via subdomains of
> freecharity.org.uk for my users. So instead of
> http://www.freecharity.org.uk/~james/ they'll be using
> http://james.freecharity.org.uk/.
>
> I already have some, statically defined, virtual hosts on subdomains of
> freecharity.org.uk, for example webmail.freecharity.org.uk. My
> configuration so far reads something like...
>
> NameVirtualHost *
> <VirtualHost *>
>         ServerName www.freecharity.org.uk
>         DocumentRoot /var/www/main/
>         ...
> </VirtualHost>
> ... numerous other virtual hosts ...
> <VirtualHost *>
>         VirtualDocumentRoot /home/%1/public_html/
> </VirtualHost>
>
> However, james.freecharity.org.uk is serving pages from /var/www/main/
> instead of /home/james/public_html/. If I place the VirtualDocumentRoot
> statement outside of the VirtualHost it swallows up requests for defined
> virtual hosts (tries to serve www.freecharity.org.uk from /home/www for
> example).
>
> Any suggestions as to how I should VirtualDocumentRoot to play nicely
> with static virtual hosts?

Put a
ServerAlias *.freecharity.org.uk
in the last <VirtualHost>

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org