Tech Tips on Computers, Internet, Blogging, Web Development, Social Media, Android and more

Full width home advertisement

Post Page Advertisement [Top]

If Internet Information Services (IIS) and XAMPP’s Apache are running on the same Windows machine, then there will be issues opening "http://localhost" due to port conflicts. This is because, both IIS and Apache services cannot use the same port. One of them need to use a different port to connect.

How to resolve Apache localhost issue when running XAMPP along with IIS web server?

By default “http” port is 80. When we open “http://localhost” in a browser, it is using port 80, which actually should look like “http://localhost:80”. By default, the port number is hidden. I have IIS running on my machine and then installed XAMPP for running WordPress. But after XAMPP installation when I go to “http://localhost”, instead of the Apache page, I was getting IIS page. Since IIS was installed before XAMPP, port 80 is already taken by IIS web server. XAMPP’s Apache is also trying to use the port 80 which is not available. So when I open “http://localhost:80” in a browser after installing XAMPP expecting Apache page, it is showing IIS page instead. If IIS was not installed, then we would have seen Apache’s page. 

IIS and Apache web servers can both coexist on the same Windows machine. But we need to configure XAMPP’s Apache configuration file to tell XAMPP Apache to use a different port other than port 80, as it is not available.

How to change localhost port number in XAMPP Apache httpd.conf file?

Changing the port number for Apache server allows you to run both IIS and XAMPP server’s on same machine using different port’s.
  • Navigate to XAMPP installation folder. By default this is “C:/XAMPP”. If you have installed XAMPP in another location, navigate to that location.
  • Under XAMPP folder, navigate to ” apache\conf ” folder and find the file “httpd.conf”.
  • 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.
  • Now open the file “httpd.conf” with an editor like Notepad.
  • FIRST EDIT:
    • Find the following lines in httpd.conf
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 80

  • Change to
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 8080
  • SECOND EDIT:
    • Find the below line in the httpd.conf file
ServerName localhost:80
  • Change to
ServerName localhost:8080
  • That’s all. Save the http.conf file
  • Open XAMPP Control Panel
  • Restart the Apache Services by clicking “Stop” then “Start”.

Test by accessing localhost:

    • Open your browser and and enter the address localhost:8080.
    • This should open the Apache start page.
Always remember to use the port number 8080 after localhost for opening websites hosted locally using XAMPP. Say if you have a WordPress installed then the admin page can open at: “http://localhost:8080/wordpress/wp-admin/”.
Note:
  • Without entering the port 8080 such as “http://localhost/wordpress/wp-admin/” will return an IIS HTTP error page.
  • 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.
  • There is no need to change anything on the IIS. It will be accessible when you type in “localhost” on the browser.

No comments:

Post a Comment

Bottom Ad [Post Page]