home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] DSL, .11g router, apache, bind, port forwarding on a small network.

  • Subject: Re: [OCLUG-Tech] DSL, .11g router, apache, bind, port forwarding on a small network.
  • From: Michael Thomas <mike [ at ] bedarra [ dot ] com>
  • Date: Sat, 08 Apr 2006 08:38:30 -0400



This is what I have in vhost.conf (the mandrake way is to include the section as a different file).

<VirtualHost 192.168.10.2>
ServerName www.myservername.net
DocumentRoot /var/www/html
</VirtualHost>

NameVirtualHost 192.168.10.2
<VirtualHost 192.168.10.2>
ServerName www.myvirtualhost.com
DocumentRoot /home/user/public_html
</VirtualHost>

It is configured this way as it seems to be the only way it wants to work for both, at least locally. If I leave the main one out, the second overrides my main site. Then, if I use the NameVirtualHost directive prior to the first entry, httpd, when restarted, complains that one will override the other, and only the first is to be used.


It should be as follows. You only need one NameVirtualHost per ip address/port pairing. Here port 80 is implied.

NameVirtualHost 192.168.10.2

<VirtualHost 192.168.10.2>
ServerName www.myvirtualhost.com
DocumentRoot /home/user/public_html
</VirtualHost>

<VirtualHost 192.168.10.2>
ServerName www.myservername.net
DocumentRoot /var/www/html
</VirtualHost>