How to setup xampp with multiple ports [Windows]

xampp default port is 80 and 443 if you have many project and want to setup project with difference port in xampp called “Virtual Hosts” this is how to setup virtual host in xampp for difference port.

  1. Update “C:\xampp\apache\conf\httpd.conf” add new listening port.
Listen 80
Listen 81 // new listening port

2. Update “C:\xampp\apache\conf\extra\httpd-vhosts.conf” add new virtual host config.

<VirtualHost *:81> 
DocumentRoot "C:\xampp\htdocs\mywebsite"
<Directory "C:\xampp\htdocs\mywebsite">
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
SetEnvIf Request_URI "(\/assets\/)" dontlog
CustomLog C:\xampp\Apache24\logs\myweb-access.log combined env=!dontlog
ErrorLog C:\xampp\Apache24\logs\myweb-error.log

3. Update “C:\Windows\System32\drivers\etc\hosts” add new host and port in this file.

#       localhost
# ::1 localhost // host with new port.

4. Restart apache again and test a new address in browser.

Written by

Web Developer #BNK48 #BLACKPINK #Nogizaka46 #SHISHAMO

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store