Apache and IIS7 Together on Windows 2008

01 Apr

Apache and IIS7 Together on SBS2008

Posted on 04 February 2009 by Shane Welldon

I’m currently evaluating Small Business Server 2008 on a machine which I also use for testing websites and learning PHP. With such tight integration of IIS7 to run the SBS services of remote access to Exchange email, SharePoint and even just web-based remote access of machine it makes it impossible to simply stop IIS and replace it with Apache. Instead we need to set them both up to run side-by-side.

At first I told Apache to run on a different port but got tired of appending the port number to the URL every time I needed to access it from my PC.

After some more research I found a way of giving the server a second IP address and running IIS7 on one and Apache on the other, both still on port 80. One caveat to this setup is that to keep outside access to Small Business Server’s remote applications is that external SSL connections on port 443 must remain routed to IIS7.

Add a Second IP Address

  1. Login to your server’s desktop and click Start –> Control Panel then open Network and Sharing Center and click Manage Network Connections under Tasks in the left panel
  2. Right-click the machine’s network adapter and click Properties, clicking Continue on the UAC prompt if enabled
  3. In the list select Internet Protocol Version 4 (TCP/IPv4) and click the Properties button
  4. In the Properties dialog click the Advanced… button down the bottom-right
  5. On the IP Settings tab click the Add… button in the IP addresses grouping
  6. Enter the new IP address of your choice and the required Subnet mask then click Add
  7. You should now have two IP addresses assigned to your machine. Click OK or close all open dialogs and windows

Bind IIS to a Single IP Address

By default IIS listens on all IP addresses assigned to the machine. We need to change this and bind it to only one. I chose to keep IIS running on the original IP address (In my case and run Apache on the second one I assigned to it (
  1. Click Start, type “cmd” in the search box then right-click cmd.exe in the Programs list and choose Run as Administrator. Click Continue on the UAC prompt
  2. In the command prompt type the following:
    netsh http show iplisten
    The list returned should be empty
  3. In the command prompt type:
    netsh http add iplisten ipaddress=
    Replacing with the existing IP address of your machine
  4. Type out the show command from step 2 a second time and you should see your IP address in the list
  5. Reboot the IIS services by typing the following in your open command prompt
    It will take a few minutes to completely shutdown and restart IIS
  6. Once IIS has reset close the command prompt and test both your IPs in a web browser again, this time IIS should only display on a single IP address

Install and Configure Apache

For the installation of Apache you’re on your own. You can either install it from scratch or use one of the combined WAMP packages out there. Personally I use XAMPP as I am quite lazy and no longer have the time to manually install all the required components separately.

Once you have installed Apache, we need to bind it to the second, unused IP address

  1. Run notepad as an administrator using the method from step 1 above
  2. In Notepad click File –> Open and navigate to the folder Apache installed in. Within this folder select the ‘conf’ folder then open up the httpd.conf file (NOTE: make sure you have All Files (*.*) selected in the drop-down box at the bottom right otherwise you will not see the files)
  3. Locate the line
    Listen 80
    And change it to
    Replacing with the second IP you assigned to your machine.
  4. Save your changes then go to File –> Open and navigate to the ‘extras’ subfolder of the conf folder and open the httpd-ssl.conf file
  5. Locate the line
    Listen 443
    And change it to
    Again replacing the IP address written here with your own
  6. Save your changes and start/restart Apache

You should now be able to view IIS on your original IP address and Apache on the new one you added. To get external access to Apache instead of IIS you would simply change the port forwarding rule for port 80 in your router to point to this new IP address instead of the original one.

Make sure that you do not change port forwarding for port 443 though as this will stop all remote access to email and other SBS 2008 services!


Posted by on April 1, 2011 in IIS


4 responses to “Apache and IIS7 Together on Windows 2008

  1. Guruprasad Balaji

    July 28, 2011 at 11:52 pm

    This was really helpful for me! Great Blog! Would like to have a Search Box enabled on this Website! Can you plz. have one in the widgets/sidebar…???

  2. Mehboob

    May 19, 2012 at 1:41 pm

    kiya baat hai Rajesh bhai!
    Excellent! Thank you for this post.

  3. Mehboob

    May 22, 2012 at 12:25 pm

    I am getting blank page on phpMyadmin. Earler it worked. Is it because of above settings?

  4. iconraja

    May 24, 2012 at 10:18 am

    Configure the PHP Myadmin as subsite(application) and let us know.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: