[vox-tech] apache2: NameVirtualHost and VirtualHost

Ted Deppner ted at psyber.com
Sat Nov 18 21:53:57 PST 2006


On Sun, Nov 19, 2006 at 12:31:59AM -0500, Peter Jay Salzman wrote:
>    <VirtualHost dirac.org>
>       DocumentRoot /www
>       ServerName   www.dirac.org
>       ServerAlias  dirac.org *.dirac.org
>       ...
>    </VirtualHost>
> 
>    # /etc/apache2/sites-available/foo.org (doesn't work)
>    <VirtualHost foo.org>
>       DocumentRoot /www/foo
>       ServerName   www.dirac.org
>       ServerAlias  dirac.org *.dirac.org foo.org *.foo.org
>       ...
>    </VirtualHost>

Won't your server alias lines confuse things?

You might know this already, you can telnet to port 80 and issue http/1.1
directives as follows to better test and isolate behavior:

  telnet localhost 80
  GET / HTTP/1.0
  <enter>

This should confirm what the base site is.  I typically, with apache 1.3,
have to configure a base site, and then add virtualhost directives for the
other sites I want.  Any time I only have virtual sites, I have odd
behaviors (kind of like what you've mentioned).

Here's an 1.1 request

  telnet localhost 80
  GET / HTTP/1.1
  Host: dirac.org
  <enter>

repeat that Host: with the different variations of your hosts until you
find a pattern... once you see what Apache's doing you should be able to
start tweaking the config and measuring the results.

-- 
Ted Deppner
http://www.deppner.us/


More information about the vox-tech mailing list