Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two servers, both running Apache.
Server 1 and 2 are on the same Public IP address.
Server 1 has a Network IP of 192.168.1.101
Server 2 has a Network IP of 192.168.1.102

example.com goes to Server 1. That is exactly what I want.
I would like for beta.example.com/* to go to Server 2, via an Apache Reverse Proxy.
However, I would like only beta.example.com/* to go to Server 2.

How would I configure Apache to proxy Server 2 only with the one subdomain?

share|improve this question
    
Where does the request to port 80 on public ip forwarded to? –  Sachin Divekar Dec 4 '11 at 9:52
    
@Sachin - It is forwarded to 192.168.1.101 –  Yoshiyahu Dec 4 '11 at 18:04
    
ok. Look at my answer below and try it. –  Sachin Divekar Dec 4 '11 at 18:09

1 Answer 1

up vote 2 down vote accepted

I am assuming that request to public ip goes to server1. You can try this basic configuration on server1 using NameVirtualHost and mod_proxy module.

NameVirtualHost *:80

<VirtualHost *:80>
ServerName beta.example.com
ProxyPass / http://192.168.1.102/
ProxyPassReverse / http://192.168.1.102/
</VirtualHost>

<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/example
</VirtualHost>
share|improve this answer
    
Works great. Thanks! –  Yoshiyahu Dec 4 '11 at 18:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.