Web Hosting Talk







View Full Version : Apache 4.0.40 VirtualHosts are working every way but RIGHT!


bawalker
03-19-2004, 10:27 AM
I am having a very strange issue at hand. I have a new webserver with Apache 2.0.40, RedHat 9 installed and am getting things setup for 2 virtualdomain hosts I'm setting up. I have entered the /etc/httpd/conf/httpd.conf file to edit to make Apache work. I have edited the following options with the following values:

Listen *:80
...
NameVirtualHost *:80
...

<VirtualHost *>
DocumentRoot /home/modemnet.biz/modemnet.biz
ServerName www.modemnet.biz
</VirtualHost>

<VirtualHost *>
DocumentRoot /home/miawmainecoons/www.miawmainecoons.com
ServerName www.miawmainecoons.com
</VirtualHost>

Here is were the strange things come into play. If I goto www.modemnet.biz that actually works and it takes me to the html file located in mdoemnet.biz's home account. BUT if I try to goto www.miawmainecoons.com it takes me to the modemnet.biz html file! I've tried for hours and hours but I seemingly can't get various domains to point to the appropriate virtualserver. I know I haven't setup something properly so any advice is appreciated.

Btw yes I have setup DNS properly so everything is working there.

Help!

GameraFan
03-19-2004, 01:06 PM
Try

Listen 80

<VirtualHost *:80>
ServerName www.modemnet.biz
DocumentRoot /home/modemnet.biz/modemnet.biz
</VirtualHost>

<VirtualHost *:80>
ServerName www.miawmainecoons.com
DocumentRoot /home/miawmainecoons/www.miawmainecoons.com
</VirtualHost>

Apache 2 is up to 2.0.48. You may want to upgrade.

bawalker
03-19-2004, 05:08 PM
Thanks for the help, but I ended up finding out the reason as to why it wasn't working. Actually I found the error shortly after posting. We use a specialized NAT setup in the data center so all internal machines have a 192.168.x.x and a routable 192.216.x.x IP. I found out I have to make the correction to the httpd.conf to show the following for BOTH ip addresses. It worked immediately.

NameVirtualHost 192.168.1.1
NameVirtualHost aaa.bbb.ccc.ddd

<VirtualHost 192.168.1.1 aaa.bbb.ccc.ddd>
DocumentRoot /home/modemnet.biz/modemnet.biz
ServerName www.modemnet.biz
</VirtualHost>