How to run IIS and Apache on same machine on port 80? Here is the solution.
- 2 Comment
This article will help you to run IIS and Apache on the same machine. There are many circumstances that warrant running IIS and Apache on the same server. For example, you are running Microsoft Reporting Service on your IIS web server and your main application is running on Apache.
In this scenario, there are a few solutions available, for instance- using different ports, proxying method or if you willing to run both Apache and IIS on port 80 then you need to choose a method which requires different IP addresses (Two LAN adapters installed) for IIS and Apache on same server.Let me describe this further :-
Different IP addresses for IIS and Apache to run on port 80.
Most of us think that if we have two IP addresses on the same server then there’s no need for this article but the fact is that you have to put efforts to make this effective as you are working on Microsoft windows server. So IIS takes preference and binds it with all available IP addresses on this server.
In short, the issue is that IIS starts listening to all available IP addresses in the servers. Even if go thru IIS settings and manually assign one IP; this does not solve the issue.
I have performed this using the following:-
· Windows 2003 Server (OS on which we need to perform this task)
· Installed Windows support tools on this server. ( I have described this below in detail)
· Two LAN adapters installed.
· Set separate IP for every LAN adapter
· Each IP have mapped with a DNS
Now Let’s Start:-
Make IIS listen on a definite IP only;-
1. Start > Run> cmd.exe (open command prompt)
2. Type on command prompt C:\Documents and Settings\Administrator>httpcfg set iplisten -i XXX.XX.XXX.X
Note :- XXX.XX.XXX.X is the IP address on which you want IIS to listen.
2.1. If the message “’httpcfg‘ is not recognized as an internal or external command, operable program or batch file.” appears that means Windows support tools is not installed. Here is the link that will help you http://www.microsoft.com/downloads/details.aspx?FamilyID=96a35011-fd83-419d-939b-9a772ea2df90&displaylang=en
2.2. If the message “ HttpSetServiceConfiguration completed with 0.” will appear then say cheese, for it works. Now let’s confirm this change by running “C:\Documents and Settings\Administrator>httpcfg query iplisten” you will receive IP : XXX.XX.XXX.X
3. Now let’s confirm this change by running “C:\Documents and Settings\Administrator>httpcfg query iplisten” you will receive IP : XXX.XX.XXX.X
4. Now you need to restart http service by performing command.
4. 1. C:\Documents and Settings\Administrator>net stop http /y
Note: - I received the following messages:-
The following services are dependent on the HTTP service.
Stopping the HTTP service will also stop these services.
World Wide Web Publishing Service
HTTP SSL
The World Wide Web Publishing Service service is stopping..
The World Wide Web Publishing Service service was stopped successfully.
The HTTP SSL service is stopping.
The HTTP SSL service was stopped successfully.
The HTTP service was stopped successfully.
4. 2. C:\Documents and Settings\Administrator> net start w3svc
Note: - I received the following messages:-
The World Wide Web Publishing Service service is starting.
The World Wide Web Publishing Service service was started successfully.
Now you need to make change in Apache configuration file
5. Edit httpd.conf, set: Listen ZZZ.ZZZ.ZZ.Z:80
Note :- ZZZ.ZZZ.ZZ.Z is the IP address on which you want Apache to listen.
6. Now you need to restart Apache. If you are running Apache as service,you can use “net stop apache” And after that: “net start apache”
That’s it!! It’s done!!

See my post for running both webservers in single machine at http://code4fun.senthil.name..
Yes…Its perfect solution.. Thanks..
Also you can help with below my suggestions..
Download the apache windows binary installer from http://httpd.apache.org/download.cgi and install. Once installed the apache sever will run automaticllay in tray. It should definately give errors that port 80 is already occupied.
This is because IIS is utilizing port 80. To overcome this problem shut down iis before installation of apache or leave it like it is. However, you have to decide whether you want to use port 80 for iis or apache.
To change apache’s default port goto httpd.conf in conf directory of installtion. Open it with editor and change
listen 80 -> listen 8080 (or whatever port you wish)
servername -> localhost:8080
Save and restart apache services.
To change iis port goto iis management console. Select web service, properties and then change default 80 to 8080 (or whatever you wish).
Restart IIS.
Thanks
Rajesh Goutam
Online Marketing Expert