Running XAMPP and Apache with IIS
If you are a web developer who likes to work at home and expand your skills,
you may want to run both IIS and Apache web servers on your local development
machine. Until recently, I wasn't sure this would be possible without some
painful changes to my configuration. As it turns out, it's not only possible,
but easy to accomplish with XAMPP. For Windows users,
WAMP is another option.
Not only will both web servers run on the same PC, they can run at the
same time. The only thing I had to do was ensure that IIS and Apache listen
to different ports. This task is quick and simple for either server.
By default, web servers listen to Port 80 for HTTP requests. If you do
most of your work with IIS, you'll probably want to configure Apache to
listen to port 8080, a common choice for test servers, or some other port.
If, like me, you want to focus on learning WordPress in a LAMP environment and test
ongoing work for clients
before putting it out there, it will be more useful to assign Apache to port
80 and IIS to port 8080 or another available port.
So, we have two scenarios:
- Let IIS remain bound to port 80 and configure Apache for port 8080.
- Bind IIS to port 8080 (or another port number, such as 85) and allow Apache to
monitor port 80. Note that the HTTP alternate port for
Apache Tomcat
is 8080. If you run this add-on, bind IIS to a different port.
How to configure Apache for port 8080
To avoid conflicts with IIS, change the port
that Apache monitors immediately after installation completes. To do this,
find the Apache folder in C:\XAMPP, or the folder in which you installed
XAMPP.
Open the conf folder and save a copy of httpd.conf as httpd.conf.bak
in case something goes wrong. Then edit httpd.conf in Notepad or another
text editor, such as UltraEdit.
There are two places in the httpd.conf where you need to change the port
number from 80 to 8080.
Find this section, and change "Listen 80" (at or near line 47), to
"Listen 8080" as shown below:
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 8080
Next, scroll down and change ServerName localhost:80 (at or near line
181) to
ServerName localhost:8080:
# If your host doesn't have a registered DNS name,
enter its IP address here.
#
ServerName localhost:8080
Open the XAMPP Control Panel to Stop and then Start the Apache service so
that the port change takes effect:

Open your browser to localhost:8080 and select your language:

The next screen is the XAMPP "home" page. Be aware that the XAMPP Status
check is hardwired to look at port 80. The Status for some services will be
reported incorrectly as disabled when they are, in fact, enabled. To get rid
of the problem, use Apache with HTTP on port 80 and assign IIS to monitor
HTTP requests on a different port.

How to configure IIS for port 8080
If you decide to leave Apache on port 80, use the IIS console to bind IIS
to port 8080 (or your chosen port number). In Windows 7, go to Control Panel/ System and Security/Administrative
Tools/Internet Information Services. Under Sites, right-click your Default
Web Site and select Edit Bindings from the menu OR select Bindings from the
Edit Site panel. In the Site Bindings window, select the row for http and
click the Edit button:

Select All Unassigned in the IP address dropdown list. Type "8080" or your
desired port number in the textbox for the Port and click OK. Restart the
server for the changes to take effect. Don't be alarmed if you come back
later and find that there are several new lines in the Site Bindings box for
net.tcp, net.pipe, net.msmq, and msmq.formatname.

Point Expression Web previews to correct port
If you use Microsoft Expression Web with your IIS development sites,
previews will still try to open localhost on port 80. To fix this problem,
open the site in Expression and click Site in the top menu.
Select Site Settings... and add your designated port number to the preview's custom URL.
In the end, I decided to bind IIS to port 85, so that's what you see in the
screenshot below:

That's it! It's easy to reverse the whole procedure, depending on your
current big project.