You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ryan Coulombe <ro...@crystaldawn.net> on 2001/03/20 01:21:52 UTC

Vhost/VirtualHost problems

I am trying to set up 2 domain names under 1 IP Address using VirtualHost configurations. My current setup is this: 2 Internal Networks (3 PC's) setup on 1 SDSL link. I also have 2 Zone files for each Domain name pointing to my DSL Router.

My DSL is down stairs, with 1 machine next to it, the Firewall and Router are both downstairs. I have another Network Upstairs (192.168.0.*) which houses 1 linux server and a Win2k Pro setup with Inet sharing. This setup works great so far, but I am not sure of how to setup Apache Virtual hosts with this kind of mickey mouse setup. I'll try to describe the network setup as best I can, since I feel that this is probably where the problem lies. 


SDSL Router IP: 64.129.146.89 
Firewall IP        : 192.168.1.1
PC1 (downstairs:  Uses DHCP off the firewall and gets a 192.168.1.* addy
Win2K             :  192.168.0.1 (eth 1) and 192.168.1.1 (eth1 connected to the Firewall downstairs.)
Linux Mandrake: 192.168.0.2  (Using Win2k as the gateway)

Firewall Port Route:  port 80 goes to 192.168.1.2 (win2k machine upstairs)
Inet Sharing route on win2k:  Port 80 goes to 192.168.0.2 (linux machine)

This setup works great for just 1 Domain name. When I go to crystaldawn.net from outside the internal network, apache loads the FIRST VirtualHost that I have setup, which is what I want. The problem is that I have TWO domain names. Crystaldawn.net and Gamers-X.net. Now, When someone goes to Gamers-X.net, it goes to the Crystaldawn.net document root, instead of the Gamers document root. This is driving me nuts, because I am almost certain that the Vhost section is correct.

Oh yea, also, I have Gamers-X.net and Crystaldawn.net setup correctly in the Zone files on granitecanyon.com (plug plug, great Free dns hosting service). Both have their own zone files, pointing to my DSL Router's IP address. I can telnet/ftp into both addresses just fine from the outside, so I know that those seem to be working.

I have tried using my IP address 64.129.146.89 in place of 192.168.0.2 in the virtualhost and NameVirtualHost places, and it produces the same result as the 192.168.0.2 address anyways (crystaldawn works, gamers does not).

I am running Mandrake 7.2 Professional Suite with Apache 1.3.12.

Here is how my Vhosts.conf and httpd.conf file look.

In httpd.conf
# BindAddress: You can support virtual hosts with this option. This option
# is used to tell the server which IP address to listen to. It can either
# contain "*", an IP address, or a fully qualified Internet domain name.
# See also the VirtualHost directive.

BindAddress *

Listen 80

In Vhosts.conf
 
NameVirtualHost 192.168.0.2

# This one works
<VirtualHost 192.168.0.2>
        DocumentRoot /home/httpd/html
        ServerName crystaldawn.net
        ServerAlias www.crystaldawn.net
        <directory /home/httpd/public_html>
                AllowOverride all
        </directory>
</VirtualHost>

#This one doesnt seem to be doing anything at all
    <VirtualHost 192.168.0.2 >
    DocumentRoot /home/alter/public_html
    ServerName www.gamers-x.net
    </VirtualHost>