The other day, I was asked by a customer how one is able to run ColdFusion with IIS and Apache on the same machine with both Webserver listening on port 80. Since this customer has downloaded our free Digital Asset Management solution, I knew his question was aimed at the Oracle HTTP Server (Apache 1.3) and that solving this could also help our own website and customers behind a firewall which would not allow traffic on port 7777 (the default port installation by Oracle HTTP).
After some thinking I came to the conclusion that this will only be possible with two IP addresses assigned to your network adapter. Thus first we need to assign the new IP to the network adapter.
If that is done we now have to tell IIS and Apache to only listen to the specified IP address. The big problem with this approach is that IIS has a featured called “Socket Pooling” that claims all ports for all loaded IP addresses, even if not configured in IIS!!!. Actually this has struck me for quite some time and it took quite some searching and reading to find this out. Fortunately there is a way to configure IIS to only listen to the IP we want.
Configure IIS to listen to only one IP address
1. First of all grab yourself the “httpdcfg.exe” utility which is within the .cab file within the support folder of the Windows Server 2003. With the latest releases you will find the folder on CD 2. To make it even easier I make it available here.
2. Now go into the command prompt and stop IIS with “net stop http /y”
3. Now tell IIS to listen to the IP you want with “httpcfg set iplisten -i 192.168.1.100″
4. Make sure that IIS has only your IP configured to listen for with “httpcfg query iplisten”
5. Restart IIS with “net start w3svc” (Changes are done but you might not see them already).
Configure Apache to listen to only one IP address
Next we need to tell Apache to only listen to the other IP address. Fortunately this takes only some small part of configuring.
1. Open up your “httpd.conf” file.
2. Search the line where it says “listen 7777″ (or your port you want to change).
3. Change this to read: Listen 80 Listen 192.168.1.101:80 If you have virtual host containers setup to listen to a IP address you will need to change those values as well, of course.
4. Save.
VERY IMPORTANT: If you have done the above you must restart your machine. Doing otherwise with just restarting IIS and Apache will not reflect the changes correctly. If you see it working we still recommend restarting your server (hey, after all it is Windows
)
Voila, after you have restarted your machine you should be able to access both IP’s one being served by IIS and the other by Apache.
This setup has been tested and known to work with Windows Server 2003 and IIS 6.x and Apache 1.3.x. Also this setup would add some security to your database since you could have a public IP address for, as an example, your IIS and have an internal IP address to your Oracle database over Apache. Your requests to the database would then go to the internal IP. Within Coldfusion your data source would then point to the internal IP. This would be a “secure” setup for your web applications which would only allow access to the database trough your web application.

