It has been know that you may want to use IIS and apache on the same machine. Some web applications will only run under IIS, and some may only run under apache. There are 3 ways to make this work.

Different ports

The quickest and dirtiest method is to make your products run on different ports on the server. This can be achieved in apache by adding a Listen 80 directive where 80 is the port you want to listen on. In IIS you would set this up on the specific site you need.

Apache proxying IIS

The above method does not look very professional. For the most parts, you can use apache to proxy or ‘front’ for the IIS server. You can set up your IIS server to run on a random port as above, and then use the ProxyPass and ProxyPassReverse directives in your apache config to map DNS names or IP addresses into virtual hosts.

Different IP addresses

Some applications hard code some things: Microsoft SharePoint is a great example of this, and will not proxy properly. The only other way is to have separate IP addresses on the server and make IIS serve on one while apache serves on the other. This sounds really simple on the front of it, but Microsoft have other ideas. Just setting an IP address to specifically listen on in the IIS config does not work, and it will always listen on 0.0.0.0 (the default - global - listening IP). You need to perform 2 steps to make it work.

ListenOnlyList registry hack

First you should stop the IIS services

CMD> net stop http

You will be prompted to switch off HTTP SSL and the World Wide Web Publishing service. Say Yes to this.

You then need to open your registry and navigate to the following registry key

HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\HTTP\\Parameters

You may have a sub-key called ListenOnlyList If it is there, chances it will probably be wrong so delete it for now. Next you need to add a “Multi-string value” and add one IP address per line. You should then be able to assign IP addresses within the IIS manager once you have restarted the World Wide Web Publishing service in the services MMC snap-in.

you can check with the following command in a DOS prompt.

CMD> netstat -ano
Active Connections

Proto Local Address Foreign Address State PID
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 396
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1236

You are only interested in the Local Address column for TCP rows that are LISTENING this shows the IP address and port that has a service on it.

Disable IIS multi addressed listening

If you only want one IP address used regardless of the settings in the IIS site configuration, then this can be achieved. care should be taken however. You need to have one line and only one line in your ListenOnlyList any more and you will find IIS back on 0.0.0.0 again.

You should then perform the following in a DOS command shell

CMD> net stop http
CMD> C:
CMD> cd C:\\InetPub\\AdminScripts
CMD> CSCRIPT ADSUTIL.VBS SET W3SVC/DisableSocketPooling TRUE

You should then restart the World Wide Web publishing service and IIS will only be listening on the specified IP address.