Tuesday, January 27, 2009

Run Running Apache IIS on same machine same port 80 different IP

Run Running Apache IIS on same machine same port 80 different IP

I use to work both in PHP and ASP and am not able to run ASP pages on Apache webserver. Can I install and run Apache + IIS on the same server/machine? If so what configuration and setting do I need?

Assuming that you want all servers to work on the standard port 80, you need a multihomed machine (i.e. multiple IP addresses) and if you are using IIS6, you need to configure it to listen only on some of these addresses.


By default, IIS takes every IPs port 80, even if you've only specified each of the websites to have a single IP. You'll need to do the following:

1) Get httpcfg.exe (it's on the Windows 20003 CD, or google it).
2) Type the following in a command prompt to stop all IIS services: net stop http /y
3) Type the following in a command prompt to stop Apache service: net stop Apache2.2 (you can get the ServiceKeyName for a server by running this command: sc getkeyname "Apache2.2" ( go to compmgmt.msc computer management to find the display name of a service)
4) Use httpcfg to configure IIS to only listen on the IP you want it to (type at a cmd prompt, in the directory httpcfg is in): httpcfg set iplisten -i
5) Restart IIS Services: net start w3svc
6) Restart Apache service: net start apache2.2

Should do the trick.

Edit: After step 4, run the following: httpcfg query iplisten

Make sure only the IP address you wanted listed shows up. If others still do, use httpcfg delete iplisten -i 192.168.1.x to delete the entry

I managed to get it working:

In this case the problem was that IIS 6.0 has a feature called Socket Pooling that claims all ports for all loaded IP addresses, even if not configured in IIS.

So, IIS was hogging port 80 on the IP address I'd designated as the Apache address and causing it to not run. I installed Windows 2003 and got IIS running. Then I turned off IIS and installed Apache, associating it with the IP and port that I wanted. Then I turned off the Apache service and restarted IIS.

Then, what I had to do was:

1- Extract the httpcfg.exe utility from the support tools area on the Win2003 CD.
2 - stop all IIS services: net stop http /y
3 - have IIS listen only on the IP address I'd designated for IIS: httpcfg set iplisten -i
4 - make sure: httpcfg query iplisten (the ip's listed are the only ip addresses that IIS will be listening on and no other)
5- restart IIS Services: net start w3svc

Voila! Apache is listening on its default ports on and IIS is listening on its default ports on

Originally Posted by peppy
I know you can run them on a different port, but I want to run them both on port 80, is the possible with two network cards

thanks for your reply

You can disable the socket pooling in iis 5.0 to release the ip and port for apache to use. here is how to do it from Microsoft website:
1.Open a command prompt and make sure you are in the X:\Inetpub\Adminscripts folder (where X is the IIS installation drive). To do this, type the following lines at the command prompt: X:

2.After you open the Adminscripts folder, type the following line at the command prompt: cscript adsutil.vbs set w3svc/disablesocketpooling true
3.The command replies as follows: disablesocketpooling : (BOOLEAN) True
4.Stop and start the IIS Admin service.5.Restart the WWW service.

Good luck!

No comments: