Installing and Running IIS and Apache Server Together on Windows Vista or Windows XP or Windows Server 2003
[Edit] Added new posts: Run IIS behind Apache. and adding more than one IP address to your computer
I run Vista and I have been using Apache for last one month. I wanted to run Python on Apache using FastCGI module mod_fastcgi but a compiled Windows version of this module was not available from FastCGI web site. So, I decided to use IIS7’s built-in FastCGI support.
If you want to run both IIS7 and Apache web server together, than here’s the information you need, just the solution for you. By default IIS7 would listen to all IP addresses your machine is assigned and it means that you can install IIS on your system but you can not run IIS web sites until you turn off Apache HTTP server. In a situation like this IIS will throw this error when trying to start a website.
Update: If you can't get two IP addresses for your PC, you can use different port numbers for Apache and IIS.
Open a command prompt and type ipconfig and hit enter. Your system must show at least two IP addresses assigned to it. If you don’t have two IP addresses, get another IP address assigned to you. (Update: you may use two different port numbers)
netsh is only available on Windows Vista or Windows Server 2008 or later and you will need to start command line with elevated settings. Replace my IP address with your system’s IP address. Repeat “add iplisten ###.###.###.###” for all the IP address bind to IIS.
I run Vista and I have been using Apache for last one month. I wanted to run Python on Apache using FastCGI module mod_fastcgi but a compiled Windows version of this module was not available from FastCGI web site. So, I decided to use IIS7’s built-in FastCGI support.
If you want to run both IIS7 and Apache web server together, than here’s the information you need, just the solution for you. By default IIS7 would listen to all IP addresses your machine is assigned and it means that you can install IIS on your system but you can not run IIS web sites until you turn off Apache HTTP server. In a situation like this IIS will throw this error when trying to start a website.
Cannot Start Web SiteThe solution is to bind a specific and separate IP addresses to IIS and to Apache. There are mainly three steps involved in this.
---------------------------
There was an error while performing this operation.
Details:
The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
---------------------------
OK
First and foremost, make sure that you have two IP addresses assigned to your PC
First make sure you have more than one IP address assigned to your system by the cable modem you are using. In some cases you might be using a network router instead of cable modem. Whatever the case may be, you will definitely need a minimum of two IP addresses.Update: If you can't get two IP addresses for your PC, you can use different port numbers for Apache and IIS.
Open a command prompt and type ipconfig and hit enter. Your system must show at least two IP addresses assigned to it. If you don’t have two IP addresses, get another IP address assigned to you. (Update: you may use two different port numbers)
Second, configure Apache to listen to a specific IP address
Open httpd.conf file from Apache/conf directory and edit the line with ServerName key. This is my new httpd.conf file:#Now, restart your Apache web server.
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
# Old value: ServerName 127.0.0.1:80
#
ServerName 192.168.1.177:80
Finally, configure IIS to bind it to another IP address
IIS binding on Vista requires you to update IIS settings and you will need to use command line tool called netsh. Open a command prompt and type netsh.netsh is only available on Windows Vista or Windows Server 2008 or later and you will need to start command line with elevated settings. Replace my IP address with your system’s IP address. Repeat “add iplisten ###.###.###.###” for all the IP address bind to IIS.
C:\Windows\system32>netshTo make IIS listen to a specific port use the syntax: add iplisten 0.0.0.0:XXX. Replace XXXX with the port number, for example, 8080.
netsh>http
netsh http>add iplisten 192.168.1.164
IP address successfully added
netsh http>show iplisten
IP addresses present in the IP listen list:
192.168.1.164
For Other versions of Windows, binding an IP address to IIS:
If you are using other versions of Windows, you will need HttpCfg.exe utility. It is available by default on Windows Server 2003 but if you're using Windows XP you can install HttpCfg.exe as part of the Windows XP Service Pack 2 Support tools. Then open a command prompt and type the following, replacing xxx.xxx.xxx.xxx with the IP address you'd like to bind to IIS:C:\Windows\system32>httpcfg set iplisten -i xxx.xxx.xxx.xxxI hope this will help some of you with this specific requirement. To make IIS listen to specific port in Windows XP use the syntax: httpcfg set iplisten -i 0.0.0.0:XXXX - where XXXX is the port number.