You want to use NameVirtualHost

For a standard apache setup you would put the directive

NameVirtualHost *

in your config before you start defining VirtualHost stanzas.

You can make one of the vhosts the default by starting a vhost stanza with

<VirtualHost _default_:80>

rather than

<VirtualHost *:80>

remember that you have to have the

ServerName directive defined for any VirtualHost that needs to be treated as a NameVirtualhost

because it depends on the server name being passed in the request to decide what content to return to the client.

A more detailed discussion is at 
http://httpd.apache.org/docs/2.1/vhosts/name-based.html




On Feb 23, 2010, at 4:56 PM, Allen Brown wrote:

I want to serve different files depending on what domain name
was used to access my server.  Reading the apache docs it looks
like the keyword I need to use is VirtualHost.

I tried
<VirtualHost brown.armoredpenguin.com>
 DocumentRoot /var/www/abrownExtra/public_html
</VirtualHost>
<VirtualHost localhost>
 DocumentRoot /var/www/apache2-default
</VirtualHost>

That works for localhost.  If I change the DocumentRoot for localhost
I am redirected to the right place.  But it doesn't work for
brown.armoredpenguin.com.  In that case there is no change in
behavior from changing DocumentRoot.

Is this the right process?  Should this have worked?
What am I doing wrong?
--
Allen Brown  http://brown.armoredpenguin.com/~abrown/
 Thoughts, like fleas, jump from man to man,
 but they don't bite everybody. --- Stanislaw Lec

_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

Larry Price
[email protected]



_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to