Running IIS and Apache (XAMPP) on the same Windows Computer

Running IIS and XAMPP Apache on the same Windows Computer

IIS is a web server from Microsoft and Apache is an open source web server which comes along with XAMPP package. They are both web servers and both listen to port 80 (http) by default. So running both IIS and Apache web server on the same computer require some configuration changes.



Scenario:
I have IIS running on my machine already and then installed XAMPP for running Wordpress. But after installation when I go to "localhost", instead of the Apache page, I was getting IIS page. They are both web servers and both listen to port 80 (http) by default. IIS was installed (enabled) on this machine before XAMPP was installed. Hence, the port 80 was already taken by IIS. After installing XAMPP, when I opened http://localhost on the browser, it opened IIS page. Earlier when IIS was not installed, XAMPP Apache Page opened up.

Cause:
This is because, both these services cannot use the same port. One of them need to use a different port to connect. 

Solution:
If you have a similar problem, here is what you need to do: change the port number for one of the web server.

How to change IIS web server HTTP port number from 80 to 8080?

If you like to change IIS's http port number instead, you can do so from IIS manager > Default Web Site> Bindings > http > change port number > restart server

edit-http-port-binding-iis-server


How to change Apache web server  HTTP port number from 80 to 8080?

In this case, I would be changing the Apache http port from 80 to 8080. Changing the port number for Apache server allows you to run both IIS and XAMPP server's on same machine using different port's.

Steps to change Apache web server  HTTP port number from 80 to 8080:
  1. First, go to c:\xampp, the default location where XAMPP is installed. If you have installed XAMPP in another location, navigate to that location. From there, navigate to " apache\conf " folder and find the file "httpd.conf".
  2. BACKUP! Before editing httpd.conf, make a backup of it. Name it to something like "httpd.conf.bak". If something goes wrong you can replace with this one.
  3. Now open the file "httpd.conf" with an editor like notepad.
FIRST EDIT:
In the httpd.conf file opened in notepad, find "Listen 80"
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 80
Change to:
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 8080
Note: Ignore the lines with # prefix - there are commented out.

SECOND EDIT:
Find the below line in the httpd.conf file
ServerName localhost:80

change it to:
ServerName localhost:8080

That’s all. Restart apache server from the xampp control panel.

TEST:

Open your browser and and enter the address localhost:8080. This should open the apache page.

Note: Always remember to use the port # 8080 for opening Apache web page or any website created and deployed using "XAMPP". Say if you have a WordPress installed then the admin page will open at:

"http://localhost:8080/wordpress/wp-admin/"

Just "http://localhost/wordpress/wp-admin/" will return an IIS HTTP error page.



XAMPP Control Panel does not open Apache page on port 8080?

Also, if you click "Admin" from the XAMPP control panel,  it will show an error page "
HTTP Error 404.0 - Not Found" where the URL requested is "http://localhost:80/xampp/". Just change the port number to "8080" and it should work.

If you would like to customize XAMPP Control Panel so that it open Apache page with port 8080, then refer this port: How to configure XAMPP to open Apache and phpMyAdmin on port 8080 by default?

There is no need to change anything on the IIS. It will be accessible when you type in “localhost” on the browser.

The XAMPP default ports:

ftp 21/tcp # File Transfer [Control] (XAMPP: FTP Default Port)
smtp 25/tcp mail # Simple Mail Transfer (XAMPP: SMTP Default Port)
http 80/tcp # World Wide Web HTTP (XAMPP: Apache Default Port)
pop3 110/tcp # Post Office Protocol - Version 3 (XAMPP: POP3 Default Port)
imap 143/tcp # Internet Message Access Protocol (XAMPP: IMAP Default Port)
https 443/tcp # http protocol over TLS/SSL (XAMPP: Apache SSL Port)
mysql 3306/tcp # MySQL (XAMPP: MySQL Default Port)
AJP/1.3 8009 # AJP/1.3 (XAMPP: Tomcat AJP/1.3 Port)
http-alt 8080/tcp # HTTP Alternate (see port 80) (XAMPP: Tomcat Default Port)




Comment with Facebook

1 comment: