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: an Ubuntu/Apache web server and a Windows 2008 IIS7 server. I have one external static IP address. All web requests on port 80 are forwarded to my Ubuntu machine. The majority of my sites reside on the Ubuntu server, however, a specific site needs to be hosted out of the Windows 2008 machine. How can I forward requests for a specific Virtual Host on my Apache web server to IIS to another host on my network?

For instance, my Apache machine is 192.168.100.110 and all requests for www.example.com need to be forwarded transparently to 192.168.100.101. All web requests will always go through the Apache machine first.

How can I accomplish this?

share|improve this question
    
look into port forwarding using iptables. It's not clear what you mean by "always go through the Apache machine." Do you mean hit the Apache host first, due to network configuration? –  mbrownnyc Sep 20 '11 at 14:42
    
My router forwards all requests for port 80 to the Ubuntu server. I can't specify at the router level to send site a to ubuntu and site b to IIS. I have to route those at the application layer. –  George Sep 20 '11 at 14:45
    
Looks like Shane has a way to do this below within Apache (using the ServerName directive to note the host). Otherwise, if you're controlling access by IP, you could use iptables, which lives in the network stack on your Ubuntu box, to redirect IP traffic. –  mbrownnyc Sep 20 '11 at 15:13
add comment

1 Answer

up vote 4 down vote accepted

Use mod_proxy:

<VirtualHost *:80>
    ServerName site.to.serve.via.iis
    ProxyPass / http://192.168.100.101/
    ProxyPassReverse  / http://192.168.100.101/
    ProxyPreserveHost On
</VirtualHost>
share|improve this answer
1  
As a side note, I had to add On after the ProxyPreserveHost. Without it, Apache complained and wouldn't let me start. –  George Sep 22 '11 at 13:54
    
@George Oops, my mistake. Edited. –  Shane Madden Sep 22 '11 at 14:51
add comment

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.