Thursday, January 22, 2009

Configuring IIS and Apache to work with multiple IPs

This is a small tip regarding configuration of IIS and Apache to co-exist on the same box listening on port 80 for HTTP traffic on different IPs.

My initial setup had Win Server 2003 with IIS 6.0 serving all domains. Incidentally, there were several different domains all pointing to the same IP address and having IIS configured to bind to All Unassigned IPs across them all.

With the introduction of Apache, I was given a new IP address and wanted to have it used by Apache alone. Turns out that IIS would auto-bind to the new address due to its All Unassigned IPs rule in the configuration. The trick to fix that is to configure IIS' IP listen list. Read the MSDN article about it or just run (via command line): httpcfg.exe set iplisten -i x.x.x.x

Restarting IIS after that is not enough (as advised by the article). I would still get apache reporting: An attempt was made to access a socket in a way forbidden by its access permissions.  : make_sock: could not bind to address x.x.x.x. 

The trick? Reboot the server. Then apache manages to listen to the 2nd address normally.

No comments: