I came across this problem in real time and typical of me, I never look at things unless the situation demands it! Being on a development (and now on a management) team the world of server configurations has always dazzled me!
Now getting to the problem at hand, We had IIS running on a windows 2003 machine and configured with multiple virtual IPs (for eg:- 172.16.72.9, 172.16.72.10, 172.16.72.11, 172.16.72.12 and 172.16.72.13). Now all these IPs were assigned to web sites created in IIS and in addition to this there were three other sites running on the same server which were running on different ports (other than port 80) but had "All Unassigned IPs" selected in the configuration.
All this being fine, the problem started when somebody decided to host one of the existing sites in Apache on the same machine and without changing any of the IPs!
Since by default IIS listens on port 80 of all the virtual IPs on a given server, Apache would refuse to start while IIS was still running. This was still the case even after I shut down the single site which was running on IP 172.16.72.9 and kept IIS running to serve the rest of the sites. The solution to this issue is given below.
Required tools
The httpcfg command. This command is available with Windows XP SP2 Support Tools if you are a XP user or under the "Support --> Tools " folder in the Windows 2003 installation CD.
Shutdown the Apache service and change the config file under Apache and modify the "Listen" property to listen to 172.16.72.9 on port 80 by adding the line given below.
Listen 172.16.72.9:80
Then modify the "ServerName" property to reflect the same by adding the line given below.
ServerName 172.16.72.9:80
Run the httpcfg command to add the specific IPs that IIS should listen to. The format for adding the IPs is given below.
httpcfg.exe set iplisten -i x.x.x.x
where x.x.x.x is the IP that you wish to add. So in the above example add all the virtual IPs except 172.16.72.9 which we intend to serve using Apache.
You can also view the configuration by running the "httpcfg query iplisten" command, which will show the list of IPs that IIS listens to.
If in case you typed in the wrong IP you can remove it by running the
"httpcfg delete iplisten -i x.x.x.x" command
Now start the Apache service.
Now for IIS
Reset the HTTPD service by running the command "net stop http /y"
Reset IIS service by running the command "iisreset /restart"
Hope this helps!
Monday, September 21, 2009
Running IIS and Apache on the same web server serving different virtual IPs
Labels:
80,
All Unassigned IP,
Apache,
IIS,
port,
Techy,
Virtual IP
Subscribe to:
Posts (Atom)