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.

Here's my setup:

Windows Server (2003) receives all traffic for *.mydomain.com, which (up to now) redirects all incoming port 80 traffic to a Linux VM (using VMWare virtual network manager).

I now need to setup another website on this server, using IIS6, to handle subdomain1.mydomain.com.

How do I separate the HTTP traffic as such:

  subdomain1.mydomain.com -> IIS
  everything else (*.mydomain.com, domain.com, raw IP) -> Linux VM

I thought of setting up an Apache server on Windows as Reverse Proxy. But can ProxyPass handle hostnames? (all examples I see handle directories).

Is there another/easier solution? Would lighttpd help?

TIA for your help.

[FWIW: Changing the architecture is not an option. Else I wouldn't ask ;-). An acceptable option if it helps (I doubt though) is to setup a 2nd public IP)]

share|improve this question

1 Answer 1

You can set up VirtualHosts in Apache, and then use ProxyPass for the subdomain1.mydomain.com to reverse proxy into IIS, and have a default VirtualHost that reverse proxies into your Linux VM.

You'd want a configuration that was something like this:

<Virtualhost *:80>

    ServerName subdomain1.mydomain.com

    ....
    # Reverse proxy into IIS
    ProxyRequests off
    ProxyPass / http://ip.of.IIS.machine/
    ProxyPassReverse / http://ip.of.IIS.machine/
</VirtualHost>

<VirtualHost _default_:80>
    ....
    ProxyRequests off
    ProxyPass / http://ip.of.linux.machine/
    ProxyPassReverse / http://ip.of.linux.machine/        
</VirtualHost>

Those configs are missing most of the configuration, but the important bits are that the first VirtualHost definition matches on subdomain1.mydomain.com, and this then does a reverse proxy into the IIS machine. The second definition matches everything else, and reverse proxies into the linux machine.

Note, I haven't tested the above as it is written, but I have definitely got an apache setup with multiple virtualhosts where one vritualhost is a reverse proxy into another machine, so the basic theory is fine.

share|improve this answer
    
Daniel, thanks! It works. Oddly though, I had to put a ServerName in the default vhost or everything would go to the other one. The only problem is that IIS (localhost, different port) thinks the client is localhost hence, in case of application error, returns a detailed explanation of the error :-( –  Serge - appTranslator Mar 25 '11 at 10:00
    
Glad it worked for you. Also, setting up a second public IP probably does help - you should (assuming windows does sane things here, I don't know) be able to bind IIS to one of the IPs, and serve it directly, and then forward everything on port 80 on the other IP through to your linux VM, and no apache+reverseproxy needed. –  Daniel Lawson Mar 26 '11 at 2:11

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.