In order to have a multi-port configuration for different virtual hosts (projects, websites) on Apache in XAMPP, you need to make changes to the following 3 Apache configuration files and 1 windows host file:
1. httpd.conf (\XAMPP\apache\conf)
2. httpd-ssl.conf (\XAMPP\apache\conf\extra)
3. httpd-vhosts.conf (\XAMPP\apache\conf\extra)
4. Windows 'hosts' file (C:\Windows\System32\drivers\etc) 👇 This file 👇
1) Implement 4 named and independent Virtual Hosts 2) Implement 4 different HTTP ports for above Virtual Hosts (8081, 8083, 8085, 8087) 3) Implement 4 different HTTPS ports for above Virtual Hosts (8082, 8084, 8086, 8088)
Checkout the following gist links for complete changes to above configuration files each:
1. [Part 1 of 4] Apache Multi-Port & Multi-Host 'httpd.conf' Config
2. [Part 2 of 4] Apache Multi-Port & Multi-Host 'httpd-ssl.conf' Config
3. [Part 3 of 4] Apache Multi-Port & Multi-Host 'httpd-vhosts.conf'
4. [Part 4 of 4] Apache Multi-Port & Multi-Host Windows hosts file Config
If you are using the windows machine as the host for your XAMPP then you need to update the 'windows host file' with the name of your virtual hosts. You can name your virtual hosts anythng you want, here is copy of my production file for referring syntax only.
👉 NOTE: Do not copy the whole file 'as-is', because it has been lifted from my production environment and may have hard-coded directory paths. I recommend only to refer the quoted key changes/modifications
127.0.0.1 localhost
127.0.0.1 www.website1.com
127.0.0.1 website2
127.0.0.1 automationdojos-demo
127.0.0.1 automationdojos-dev
127.0.0.1 automationdojos-prod
127.0.0.1 wordpress-vanilla