Running Apache and MySQL side-by-side with IIS (or WebMatrix and Web Platform)

Posted: 2016-04-14 00:30:23

As a rule, only 1 process is allowed to bind to a specific IP:port (an interface). And the first process that takes that specific IP:port will prevent all other processes, that use the same IP:port, from starting…

Apache and IIS will both try to take port 80 (the HTTP port) and port 443 (the HTTPS port) – on IP “”.

MySQL will try to take port 3306 (the default MySQL port) – on either IP “” or IP “”.

“” specifies binding to all IP addresses the system has, including And “” is the standard localhost IP – used to bind services for local-access only.

To run multiple servers side-by-side (on the same system), 3 options are available (from the very simple to the more complicated):

A) Run Only 1 Platform at a Time

Stop IIS, start Apache. And vice-versa.

With multiple MySQL instances, run 1 instance at a time.

Note that when using both MySQL and SQL Server, you can run both at the same time as they use different ports (and they will not conflict).

B) Keep Listeners Bound to the Default IP(s), But On Different Ports

This is only a valid solution for local use and local development.

Select each website in IIS (including the Default Website), change the binding properties from *:80 and *:443 to other ports such as 8080 and 8443.

Update Web Platform’s MySQL’s my.ini file to change “port = 3306″ to another port such as 3307.

Update URLs to Use New Ports

With the above re-binding, all IIS websites will now be reachable from URL:

How URLs Work

By convention, all web-servers use the same standard ports (for HTTP and HTTPS)…

When a request is made from your Browser to, it resolves the domain name to an IP address, and the request is automatically sent to that IP on port 80 (and to port 443 for HTTPS traffic).

In effect, all standard URLs (i.e., without a user specified port) are short-hand for:

Update Database Connections

Webapp configuration files, other script files, and any programs that connect to Web Platform’s MySQL, will need to be updated to reflect the new port number to use.

This includes phpMyAdmin (phpmyadmin\

C) Keep Default Ports, But Bind Listeners On Separate IP Addresses

Your system will likely have:

It is best to have WampDeveloper’s Services include the use of IP – otherwise you’ll have to use an editor to do an auto-search for all instances of (and some variations that can be picked up with string “127”) in WampDeveloper’s folder to update the local configuration structure for use of another local IP.

Bind Apache from the default of “” to specific IPs (including IP And Web Platform’s IIS to another specific IP. And perform the same for multiple MySQL servers…

For Apache

Edit file – C:\WampDeveloper\Config\Apache\httpd.conf
Replace these two lines (one is at the beginning, the other at the end) –

Listen 80
Listen 443

With –


Preferably also include Listen and Listen

For Web Platform

Select all websites (including Default Website) in IIS and change their bindings to the other IP.

If another instance of MySQL was installed (via Web Platform), edit its “C:\Program Files\MySQL\MySQL Server\my.ini” file and change bind-address = to the other IP.

If you have to keep Web Platform’s MySQL server on, bind WampDeveloper’s MySQL to something other than

Edit file – C:\WampDeveloper\Config\Mysql\my.ini
Update line bind-address =

Edit file – C:\WampDeveloper\Tools\phpMyAdmin\
Update all instances of “” (that is used for the connection IP and in the access control list).


You can run multiple servers at the same time and use the ProxyPass feature to have Apache act as the front-end, transparently proxying requests back-and-forth for specific URLs and websites.

This way you can have 1 public-facing server (Apache on port 80) serving all requests, and multiple back-end servers such as IIS and Tomcat running websites and scripts that use ASP.NET and Java.