« UKCFUG Meeting Rescheduled - 15 June 2006 | Main | UKCFUG: Coldpsring and Model Glue 2 Presentation tonight! »

Running Apache and IIS 6 together on the same server

We have a Windows Small Business Server at work, which we wanted to install Subversion onto. We therefore wanted to run Apache on the same server. However, IIS is also installed on the same machine for Small Business Server purposes so I couldn't just remove IIS.

I had added multiple IP addresses to the server so that IIS could have one and Apache could have another (so they could both run on port 80). However, I ran into the problem that IIS was taking control of all IP addresses on port 80 and so Apache wouldn't start. It seems that IIS 6.0 has a "feature" called Socket Pooling that claims all ports for all loaded IP address (even if not configured in IIS) - nice! So IIS had control of the port 80 on the IP address I had assigned to Apache.

Do not fear - there is a workaround:

  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 192.168.1.253
  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
  6. start Apache service

You'll then find that Apache and IIS will then play nicely together and run on the correct ports on the correct IP addresses. Woo hoo!

Note: Thanks to agrikk on p2p.wrox.com.

TrackBack

TrackBack URL for this entry:
http://movabletype.prismix.com/mt/mt-tb.cgi/84.

Comments

Couldn't you just went into Computer Management Console, right-click on the web and set each IIS web to only listen to the appropriate IP Address, instead of all unassigned?

Hi TC,

Unfortunately that didn't work because of IIS's feature called "Socket Pooling" where regardless of what's specified in the Web Sites, IIS still hogs all port 80s on all IPs.

Therefore, to tell IIS only to use a specific IP address you need to use the above steps.

It's a real pain!

Hi Niklas - could you not have Apache run on a different port?

That's very good, but if i could have the procedure when running Apache and IIS with 2 port (IIS 80 & apache 81)
Thank.

Yes, but I needed it to run on port 80 aswell! :)

BTW, nice to finally meet you on Thursday! :)

httpcfg query iplisten lists only the IP i assigned to IIS, but apparently all the IPs are being hoged by IIS... any clues

Did you follow all the steps above?

Serge: You can just specify another port on the Apache httpd.conf file. Just specify port 81 instead of 80.

THis is great, thank you. These guys are missing the point of what you have found here. I have been struggling with this for several hours until I can across this post. This is very handy when you want to have multiple flavors of webservers on the same machine, each with their own ip addresses, each listening on port 80. thank you for taking the time to post this.

Hello,
just a precision. In some case IIS will keep grabing all the IP.
You have to specify the port to be very sure it will only bind to the requested ones :

httpcfg set iplisten /i 192.168.1.253:80

My two cents :-)

A better thing would be to use the command httpcfg delete iplisten /i [IPNumber]

In this case you tell iis not to listen to a specific address for the second webserver and if you have several other addresses, iis continue to listen to all these other addresses.

We now have IIS and apache running on the same server and both using seperate outside IP's giving us hosting options on the same machine. I only have one request, we are using Small Business Server and the monitoring and backup pages do not work after doing this. They call a webpage and I believe they are trying to use loop back (127.0.0.1) which is of course the problem. We cannot of course view companyweb either. Can anyone help?

I want to have both running on my server becuase frankly, I hate IIS, but is required for a lot of our applications. I am however nervous about the issue in the above comment. Is this issue isolated or has anyone else noticed this? Please let me know.

Nice to know that, thanks!

I know about that on IIS5, MS has a solution: http://support.microsoft.com/default.aspx?scid=kb;en-us;259349

Does this not work with IIS 6?

To disable iis from capturing all port 80 I believe you need to disable the multi address listening function in iis.

open a console ([start] [execute] cmd )
At a command prompt, switch to the "C:\InetPub\AdminScripts" folder.
Type the following command:
CSCRIPT ADSUTIL.VBS SET W3SVC/DisableSocketPooling TRUE
exit the console
Restart all the IIS process
IIS is now listening only on the IP you wish to listen to.

I have not tried this but think it should work.

Trevor

(ref- www.faqts.com)

DisableSocketPooling is just NOT enough. you need to use httpcfg to shortlist the IP addresses what IIS will be listening to.
Details:
http://www.foxgeek.com/miscellaneous/iis-apache-listen-on-port-80-on-the-same-machine.html

This post saved me from pulling my hair out. I did have to download httpcfg from MS since I am on a VPS host and getting the ISP to load a WIN2003 CD is non-trivial.

Thanks

This was a fantastic help! I was struggling with this doggone issue for half a day and then tried this out and voila! And then I see that this is also a CF forum which makes it even better! Thank you,

roger

Thank you! I will be doing this soon and was concerned that there would be an issue like this, now I know how to avoid it!!

Hi.
Thank you for that, but does anybody know about is there any tool in windows 2000 like httpcfg in 2003?

If both are running on the same server what page do you get when you type http://localhost ??

localhost resolves to the ip 127.0.0.1. So whichever service you have listening on that ip will return the page for localhost.

Post a comment