Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 and all requests for need to be forwarded transparently to 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
up vote 4 down vote accepted

Use mod_proxy:

<VirtualHost *:80>
    ProxyPass /
    ProxyPassReverse  /
    ProxyPreserveHost On
share|improve this answer
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

Your Answer


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.