Managing multiple sites on XAMPP

2.4k Views Asked by At

I have multiple sites deployed on xampp. For now, all of the sites are using one port i.e. 80. For this reason, whenever I am logged into one of the sites, I am automatically logged out from the other and vice versa. I have looked at this article to How to run multiple websites on XAMPP on Windows. And tried to follow it but I am unable to do the needful.

I have added one more port to listen

Listen 80 
Listen 8080 

In my httpd-vhosts.conf I have done the following

NameVirtualHost *:8080
<VirtualHost *:8000>
DocumentRoot "F:\xampp\htdocs\mdc"
ServerName localhost:8080
<\VirtualHost>

After doing this I have turned off my xampp and then tried to restart apache and mysql. But apache is not starting

enter image description here

My URL is http://localhost:8080/mdc/backend/web

Note: Without doing any virtual host setting the above URL is accessible on both 80 and 8080 ports

Update 1

Herer is my httpd.conf file

2

There are 2 best solutions below

0
On

This is not a fix for your issue, Here i will explain how i manage multiple websites on xampp.

First i assumes that your using windows

i always use the same port with different server names.

on : E:\xampp\apache\conf\extra\httpd-vhosts.conf (In my case i installed xampp on E drive) i added this code

    <VirtualHost *:80>
      DocumentRoot "e:/xampp/htdocs/mysite1"
      ServerName mysite1.flames.com
    </VirtualHost>

    <VirtualHost *:80>
      DocumentRoot "e:/xampp/htdocs/mysite2"
      ServerName mysite2.flames-team.com
    </VirtualHost>

And on ( C:\Windows\System32\drivers\etc\hosts) my windows host file i added this lines

127.0.0.1 mysite1.flames.com
127.0.0.1 mysite2.flames-team.com

With this approach you can access the site with a clean readable URLs

In this case if you want to see the first site just enter this URL mysite1.flames.com on browser.

Cheers

0
On

Write the closing tag </VirtualHost> instead of <\VirtualHost> in the file httpd-vhosts.conf. I did it and it worked for me.