Forum Moderators: phranque
Computer one has external ip address 1.2.3.4 and internal ip of 192.168.1.1
Computer two has internal ip 192.168.1.2
I have website1.com and website2.com, both of these resolve to ip 1.2.3.4 correctly.
Computer one’s httpd.conf has two virtual host entries. One for website1.com going to 192.168.1.1, the other for website2.com going to 192.168.1.2. website1.com resolves to the appropriate place, the root directory specified in virtual host.
Website2.com resolves there too. It does not resolve to the apache server running on computer two, but instead winds up going to the index page for website1.com. That makes sense, since if I just typed in the ip address 1.2.3.4 I would wind up at the same page. But I need to find a way to get website2.com to go where I want it to, computer two’s apache server on 192.168.1.2.
<VirtualHost 192.168.1.1:80>
ServerName "www.website1.com"
DocumentRoot "/www/www. website1.com"
</VirtualHost>
<VirtualHost 192.168.1.2:80>
ServerName "www.website2. com "
DocumentRoot "/www/www.website2. com "
</VirtualHost>
What else do I need?
The basic problem is that you've got one public IP and multiple hostnames, and routers can't (generally) read HTTP headers. So how is the router to know which server to pass any given hostname request to? Only a server set up to recognize the various name-based hosts can do this (cheaply/easily). (I am assuming you don't want the bother of using multiple port numbers on the public IP).
If there really is an easy way to do this on IIS, I'd like to know what the procedure is. I see the same fundamental problem regardless of what server software is used.
Jim