4

I have a CentOS5 server with Apache, which have one external IP address with the hostname "example.com".

What I like is that

sub1.example.com sends http requests to 10.10.10.10
sub2.example.com sends http requests to 10.20.20.20

Looking at the mod_proxy for Apache, I can't figure out what I need to configure to get that.

Does someone know how to do this?

1 Answer 1

11

You'll have to create two virtual hosts for apache one for each subdomain, acting as a reverse proxy to the specified ip.

something along the lines of

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName sub1.example.com

    ErrorLog "var/log/sub1_error_log"
    CustomLog "var/log/sub1_access_log" common

    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPass / http://10.10.10.10/
    ProxyPassReverse / http://10.10.10.10/
</VirtualHost>

<VirtualHost *:80>
    ServerName sub2.example.com

    ErrorLog "var/log/sub2_error_log"
    CustomLog "var/log/sub2_access_log" common

    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPass / http://10.20.20.20/
    ProxyPassReverse / http://10.20.20.20/
</VirtualHost>
1
  • np, glad I was able to assist.
    – Marcel G
    Sep 21, 2010 at 13:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .