(Draft)
Sure they can. But there is a catch in it, as always.
You cannot run them at the same IP address and same TCP port. You'll have to use either different TCP port or different IP address. This guide covers latter one. This guide expects that you know how to register multiple IP addresses to your servers network adapter. It is also expected that you know how to use Windows Registry.
First you need to tell IIS not to hog every available IP address to itself, as it is very keen on to do so.
Note:
At the IIS startup, IIS will hog every possible IP address. Thus if Apache is already started using some of those
addresses IIS starts but the sites in it won't. But we can bypass this problem.
Open httpd.conf file and change Listen runtime directive to match your IP address reserved for Apache:
# # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the# directive. # #Listen 3000 Listen 192.168.0.1:80
You also need to change BindAddress runtime directive to match your IP address reserved for Apache:
# # BindAddress: You can support virtual hosts with this option. This directive # is used to tell the server which IP address to listen to. It can either # contain "*", an IP address, or a fully qualified Internet domain name. # See also theand Listen directives. # BindAddress 192.168.0.1
Save changes and stop Apache if it is running.
When services start, IIS need to be started before Apache. Because IIS is trying to use every single IP address registered to your server at first. When it is completely started it'll use IP address configured to it. Thus it is necessary to change the start up order for these services. The ugly part is that there is no tool (free as I know) for it and it need to be done in systems registry.
Open registry editor (regedt32 not regedit). Find key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Apache
Add new REG_SZ value named Group. And set it string data to: apache. So you should find new value under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Apache saying:
Group: REG_SZ: apache
Find key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC
Add same value than you did with apache except set the string value to: IIS. So you there should be new Group value:
Group: REG_SZ: IIS
And atlast find key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ServiceGroupOrder
Double-click List value and add groupnames IIS and apache to this list. Each at it's own line and make sure you'll put IIS before apache.
Press OK to save changes. Restart your system. Check that both IIS and apache is started properly.