Multiple servers 1 IP address, can apache do...

Discussion in 'Apache' started by da3533, Aug 19, 2010.

  1. #1
    my problem is that i cant get more than 1 ip address and i have 2 servers. domains will be hosted from server1 and from server2 ( i dont want all to be hosted by 1 server, i need them separate)

    i have 2 hostnames s1.server.org and s2.server.org both of which points to my main IP. 80.xx.xx.xx (made by DynDNs.org)

    i want all domains that have WWW CNAME records of s1.server.org to be hosted by server1@ 192.168.1.1 and all domains that have cname WWW record of s2.server.org to be hosted by server 2@192.168.1.2

    so my problem is that i need a way to filter the requests coming in. thus, those domains that come from cname WWW records of s1.server.org will be hosted by server @192.168.1.1 and those with cname WWW records of s2.server.org will be hosted my server @192.168.1.2


    basically, for every domain out there that has their CNAME WWW as serv1.server.org, i want them to be hosted by 192.168.1.1 server and those with serv2.server.org to host by 192.168.1.2.

    i thought a proxyreverse would do this..but i dont think it will work for my situation. so i did this:

    
    NameVirtualHost *
    <VirtualHost *>
        ServerName s1.server.org
    
        ProxyRequests Off
        <Proxy *>
            Order deny,allow
            Allow from all
        </Proxy>
    
        ProxyPass / http://192.168.1.1 #server1
        ProxyPassReverse / http://192.168.1.1 #server1
        <Location />
            Order allow,deny
            Allow from all
        </Location>
    </VirtualHost>
    <VirtualHost *>
        ServerName s2.server.org
    
        ProxyRequests Off
        <Proxy *>
            Order deny,allow
            Allow from all
        </Proxy>
    
        ProxyPass / http://192.168.1.2 #server2
        ProxyPassReverse / http://192.168.1.2 #server2
        <Location />
            Order allow,deny
            Allow from all
        </Location>
    </VirtualHost>
    
    Code (markup):
    what i wanted the above to do is, let apache direct to the appropriate servers accordingly... eg. www.domain1.com has Cname WWW s1.server.org , so if someone goes to www.domain1.com, apache will direct to 192.168.1.1 (server1)

    but now i realized, apache doesnt use cname when scanning through vhost thus why it kept loading the first vhost and ignoring the last..
     
    da3533, Aug 19, 2010 IP
  2. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #2
    Have a look at http://www.apsis.ch/pound it allows you to direct requests based on the request URL so should do what you want.
     
    tolra, Aug 20, 2010 IP