Running IIS and Apache On the same Server

This article will help you to you to configure Apache and Internet Information Server(IIS), so that you can run each of these simultaneously on same Windows PC.I am a beginner in IIS and .NET and trying to learn application development in ASP.NET.I have already Apache server running on my system on port 80 and now I also installed IIS on my system.Whenever I type localhost in my browser the Apache server page show up but the IIS server page is nowhere. 
The problem lies in the fact that ,by default, both Apache and IIS uses the same port 80 and so they are conflicting with each other.The solution of the problem is simple.You just need to change the port of either Apache or IIS, so that port 80 is occupied by only one of them.Here I am going to demonstrate you guys how to make IIS and Apache listen to port other than 80.
                                           I am presuming  you already installed Apache and IIS on your system and you are using them as local servers.Also this tutorial is tested on Windows 7 and 8 ,but it should also works fine on windows 2008 server.

Change the default port number for Apache Server:

If you want to change the default port number for Apache server, follow these steps:

  • For this,you just need to make few changes in the httpd.conf file.
  • Go to Apache installation directory, look for the folder conf and inside it find the file httpd.conf.I have installed Apache in C drive ,so the path to this file is C:Apache2.2confhttpd.config.
  •  If you are installed WAMP Server then you can found this file by going to C:wampbinapacheconfhttp.conf.
  • Open this file with notepad and search for Listen 80. (by pressing ctrl+F)

changing port number in apache

  • Change Listen 80 to  Listen 8080 .You can also choose other number but 8080 is easy to remember.
  • Next Find ServerName localhost:80 and change it to ServerName localhost:8080.That’s it .Now restart your apache server and type in your browser localhost:8080 .You should see the apache Server page.
apache port number change
                               Before Making changes  
apache port number change
                           After changing the port to 8080
Change the default port number for IIS Server:
The default port number for IIS server is also 80 but you can easily change it.Here it is explained in simple steps.
  • As I am expecting that you have installed the IIS sever either in windows 7 or windows 8 ,just click start button and search for IIS.Windows 7 users can use the search option available under programs list.You will Find a program named Internet Information Services(IIS) Manager.Just click it to open it.
  • On the left panel of the window click arrows to expand until you see the Default web site.Right click on it and select Edit Bindings.
changing port number in IIS
  • Here you can see that 80 is written under port.You need to change this.Highlight it by clicking on it and select edit.change 80 to 81 and click ok.
changing port number in IIS
  • Restart the IIS server by clicking Restart on the right panel.
restarting the IIS
  • Open up your browser and type localhost:81 and it should show you the IIS server page.Here are the screenshots.
IIS
                     Before making changes
 
IIS
                   After changing port to 81
 
You need to change the port number only one of them in order to work them together on the same PC.Want to suggest an Improvement? Use the comment box below.

Recent Articles

Related Stories

8 Comments

  1. Hi Amar, thanks for the info. I have the following problem: I set up IIS on port 8080 and I can effectively run both servers together on different ports, but every time windows starts up I need to go to the command line and add any ip via netsh http add iplisten. Otherwise apache won't start. Then, after it has started I have to remove the iplisten, otherwise it doesn't work properly. After that everything works fine, but it's very annoying having to do this every day. Do you have any idea why this could be? And also, I'm not sure how I could install apache and mysql as services using the last version of xampp server, I'm always starting them manually. Thank you very much for any help you could give.

  2. The reason that your apache service is not running automatically is that port 80 is already occupied by some other program.in order to test this, go(in toolbar) to WampServer > Apache > Service >Test Port 80,it will show you the error that port 80 is occupied and also by which application.Next you need to stop this application from running automatically at windows startup.
    For this,go to run(windows key+R) and type services.msc and look for the application you find in above step. double click on it and in start type change Automatic to disabled.Also make sure that wampapache is set to automatic.Hope it helps ……..

Leave A Reply

Please enter your comment!
Please enter your name here

Stay on op - Ge the daily news in your inbox