HOWTO: Run IIS and Apache on Windows

For you web developers out there using Windows, you might not know that you can run both IIS (for .NET) and Apache (typically on Linux) side-by-side on Windows. IIS comes with XP Pro and Vista, but a lot of people don’t know that you can still leverage Apache as a web server. I personally use it for PHP and MySQL, so… alas, WAMP: Windows, Apache MySQL, PHP.

1. Download & Install WampServer 2

First, download Wamp. Now install; a good spot is c:\wamp.

2. Configure Apache to run on an alternate port

By default, a web server runs on port 80. If you’re running IIS, it’s probably running on port 80 and Apache tries to as well. Let’s change it so Apache runs on port 8080.

You’ll see the icon for WAMP is yellow (WAMP Port Conflict), meaning not all services are running. That’s because Apache is trying to use port 80, but it’s conflicting with IIS. Click on the WAMP icon and go to Apache > httpd.conf

Scroll down and change Listen 80 to Listen 8080. Scroll down even further and change ServerName localhost:80 to ServerName localhost:8080. Those two changes will tell Apache to use port 8080. To restart WAMP, click the WAMP icon and choose Restart All Services. The icon should now look like WAMP is Running

That’s all you really need to get things started. Don’t forget to restart the services every time you change the httpd.conf file.

3. Additional Customizations

Make your websites visible to others

To allow other people on your network to see your sites running on Apache, all you need to do is it clikc the WAMP icon in the systray and click Put Online. It will restart the services and make your sites visible to others. This setting is necessary if you’re on an actual live server environment.

Run multiple sites using different ports

It’s possible to run multiple sites in Apache, you just need to dish out different ports to access them. Below are two blocks of config lines necessary to make two websites run on different ports:


NameVirtualHost *:8080
<VirtualHost *:8080>
ServerName localhost
DocumentRoot "
C:/wamp/www/site1/"
<Directory "
C:/wamp/www/site1/">
Options Indexes FollowSymLinks Includes
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>


NameVirtualHost *:8081
<VirtualHost *:8081>
ServerName localhost
DocumentRoot "C:/wamp/www/site2/"
<Directory "
C:/wamp/www/site2/">
Options Indexes FollowSymLinks Includes
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>

And that’s about it. Do you have any more tips? Leave them in the comments.

 

Comments

  1. Pingback: bobpeers -> blog » The Easy Way to Install a WAMP Server

  2. Pingback: Chris Paul » Blog Archive » Sep 17, 2009 Daily Links

Leave a Reply

Your email address will not be published. Required fields are marked *