How To Change Apache Http & SSL Ports in XAMPP

Changing default apache http & https ports including virtual hosts

Why change Apache Port

By Default, Apache runs HTTP on port 80 and SSL on port 443 in XAMPP. Generally, you may need to change the port number for the following reasons :

  • For customized network design.
  • For security purposes.
  • For resolving port conflicts with other applications.

For example, users commonly report a conflict between Skype and Apache both using port 80.

Checking port availability

Before you proceed, you should make sure that you have an available port and that the port you are choosing is free and not already occupied. Here is a list of a couple of tools you can use to find the status of ports on your localhost.

NetStat command on windows

On windows, you can use ‘netstat’ command to list active networks (incoming and outgoing) connections and listening ports. You can use the command with the following switches to print port status for your localhost:

netstat -ano
  • “a” will display all connections and listening ports.
  • “o” will show the owning process ID that is related to each of the connections.
  • “n” will show the addresses and port numbers as numerals.

XAMPP’s in-built NetStat tool

If you prefer, you can use the ‘NetStat’ tool built inside the XAMPP itself. Behind the scene, it probably uses the same windows command and the output is almost the same as the native ‘NetStat’ command in windows.

Windows Resource Monitor

The third option if you prefer is the windows ‘Resource Monitor’. You can launch the ‘Resource Monitor’ via the ‘Task Manager’ as shown in the below screenshot. Once you have launched ‘Resource Monitor’, you can view the port availability status under the ‘Listening Ports’ tab.

Changing Apache HTTP port

Edit the ‘httpd.conf’ file usually located inside “XAMPP\apache\conf\” on windows and make the following changes.

HTTP Listen Port

Current configuration
Listen 80
New configuration
Listen 8081

HTTP ServerName and Port

Current configuration
ServerName localhost:80
New configuration
ServerName localhost:8081

Changing Apache HTTPS (SSL) Port

Edit the ‘http-ssl.conf’ file usually located inside “XAMPP\apache\conf\extra” on windows and make the following changes

HTTPS Listen Port

Current configuration
Listen 443
New configuration
Listen 8082

HTTPS ServerName and Port

Current configuration
ServerName www.example.com:443
New configuration
ServerName www.example.com:8082

VirtualHost Directive for httpd-ssl

Current configuration
VirtualHost default:443
New configuration
VirtualHost default:8082

Changing Ports for VirtualHosts

Edit the ‘httpd-vhosts.conf’ file usually located inside “XAMPP\apache\conf\extra” on windows and make the following changes:

HTTP Virtual Host URL

Current configuration
VirtualHost *: 80
New configuration
VirtualHost *: 8081

HTTPS (SSL) Virtual Host URL

Current configuration
VirtualHost *: 443
New configuration
VirtualHost *: 8082

Changing HTTP/HTTPS in XAMPP Panel

Now, we need to also update the above port numbers in XAMPP configuration, so that both XAMPP and Apache are able to communicate over the right port numbers. For this, do the following:

Launch XAMPP Configuration from XAMPP Control Panel

From the ‘Configuration of Control Panel’ window click ‘Service and Port Settings to launch ‘Service Setting’

On the ‘Service Settings’ window, enter Main Port and SSL Port number as set in previous steps. In our example here these would be Main Port: 8081 and SSL Port 8082.

Make HTTP and HTTPS port changes Click Save to save service settings

RESTART THE APACHE SERVICE! DONE!

Tushar Sharma
Tushar Sharmahttps://www.automationdojos.com
Hi! This is Tushar, the author of 'Automation Dojos'. A passionate IT professional with a big appetite for learning, I enjoy technical content creation and curation. Hope you are having a good time! Don't forget to subscribe and stay in touch. Wishing you happy learning!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

RELATED POSTS

Why WordPress Installation Ends Up with latest version?

1. Why You Need Older WordPress Versions Of course, running the latest version of WordPress is the best option for any website, but at times,...

How To Configure Virtual Hosts in XAMPP

Apache has made it very easy to have multiple websites or web applications running on the same physical server, and access each using a...

How To Install WordPress Locally using XAMPP

1. Introduction Installing WordPress on your computer helps you try out WordPress, test themes and plugins, and learn WordPress development.  It lets you operate a...

How To Set XAMPP To Run As-Admin By Default

Why run XAMPP as-admin The XAMPP is recommended to be executed as-admin as it requires running a couple of system services such as Apache, MySQL...

Â

RECENT 'HOW-TO'

How To Install Oh-My-Posh On Windows PowerShell

Oh-My-Posh is a powerful custom prompt engine for any shell that has the ability to adjust the prompt string with a function or variable. It does not...

MORE ON CODEX

MORE IN THIS CATEGORY

How To Sort List in Java

Introduction A List is an interface in the Java collection framework. It can be used to store objects. Programmers often encounter scenarios where they need...

How To Use Mouse and Keyboard Events with Selenium

In this tutorial, we will discuss how to use mouse click events and keyboard events with Selenium WebDriver. The mouse click and keyboard events...

How To Setup Automatic SSH-Agent for GitBash

Using below procedure, you shall be able to setup SSH-Agent to run automatically whenever GitBash is launched on Windows. The ssh-agent process will continue...

How To Change Font for Eclipse Package Explorer

This article shows how to change the Package Explorer text size and style. The font used for tree and table views can now be customized...

CHECKOUT TUTORIALS

VBS Part 2 – Fundamentals and Concepts

Having gone through the Introductory part, it is time to look at some crucial fundamentals and concepts. This article is to refresh some of...
- Advertisement -spot_img