Forum Moderators: phranque

Message Too Old, No Replies

One IP, multiple domains, multiple servers?

technical help

         

morrow

5:19 pm on Apr 11, 2007 (gmt 0)

10+ Year Member



I have one IP address. I want to set up multiple domains. Each domain has its own server, one of which is the same server that is exposed to the internet, another only has an internal IP address.

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?

morrow

2:57 pm on Apr 12, 2007 (gmt 0)

10+ Year Member



No responses? Come on, what do I need to bait you guys by saying:

If this were Microsoft IIS this would be so easy!

g1smd

12:23 am on Apr 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>> Computer one’s httpd.conf has two virtual host entries. <<

The entry needs to be in the config file of the computer that hosts that actual site, I think.

jdMorgan

3:14 pm on Apr 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unless your router is very smart -- able to parse HTTP hostname headers in the request, it seems to me that the only solution is to port-forward request for all domains to a single server, and then have it reverse-proxy requests for all hostnames (or any but it's own hostname) to the other back-end servers hosting the other sites.

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