This post is the result of my day long search for running both webservers in my server. Because I need to run wordpress on Apache for better mod-rewrite and FastCGI and other ASP websites on IIS. But there is no good resource on internet for this, there are million questions with no answer. So I tried myself to find a solution, here is it…
Understand few things before start,
1. You can’t run (or listen) two instance (or webserver) in same ip and same port on same server.
2. But you can listen on different IP in same port.
3. So you should have more than one IP to run two websers listening on same port, atleast 2 IP is required.
OK, now I assume that your have 2 IP address named IP1 and IP2, where IP1 and IP2 are two different IP address. And you are running under Windows 2003 and IIS6.
We are going to bind IP1 to IIS and IP2 to Apache and configure both server to listen on only the particular IP(s).
First Install Server Support Tools for Windows 2003, you can download from Microsoft. Here is the link to download: http://www.microsoft.com/downloads/details.aspx?FamilyId=6EC50B78-8BE1-4E81-B3BE-4E7AC4F0912D&displaylang=en.
Step 1:
1) Open Command Prompt, change the path to C:\Program Files\Support Tools.
2) Type the command “httpcfg set iplisten -i IP1?, this command will add IP1 to the IIS listening IP list. You can add any number of IPs.
3) You can check the listening IPs by giving the command “httpcfg query iplisten”.
4) Now exit the command prompt and restart the system.
Step 2:
Edit your all IIS websites to listen only on IP1. Help available on Microsoft website if you need.
Step 3:
Now edit Apache configuration file (httpd.conf) to listen on IP2.
It’s simple, just open httpd.conf and edit the line “listen “, replace the to IP2, where IP2 is your another IP.
If you are using Virtual Hosts, change all hosts to listen on IP2.
I assumed that you correctly installed Apache.
Now you are running IIS and Apache in same server on same port SUCCESSFULLY!
If you need more help, mail me to theone@senthil.name, I am happy to help.