Exocitus
Exocitus

Reputation: 11

2 sites with different XAMPP root directory

I want to configure my XAMPP to have 2 different localhosts and sites with 2 different root directory

Let's name they: SITE1 and SITE2

But when I try to acess the url of SITE1 (example: 111.111.111.111:8090) he put me at the folder selection

I solved the problem putting in the httpd.conf Document Root the directory root of my SITE1 (Directory "C:/xampp/htdocs/SITE1"), but now it's the problem, there's any way to solve that for the SITE2?

I want to acess the url of SITE2 with example: 111.111.111.111:8091 (Because I want to point the DNS for some domain) and go direct to directory ''C:/xampp/htdocs/SITE2'' not the folder selection

Upvotes: 1

Views: 1122

Answers (1)

odan
odan

Reputation: 4952

Open with Notepad++: C:\xampp\apache\conf\httpd.conf

Add this lines under Listen 80

Listen 8090
Listen 8091

Open with Notepad++: C:\xampp\apache\conf\extra\httpd-vhosts.conf

Append this new section

<VirtualHost *:8090>
    ServerAdmin [email protected]
    DocumentRoot "/xampp/htdocs/site1"
    ServerName site1.example.com
    ErrorLog "logs/site1-error.log"
    CustomLog "logs/site1-access.log" common
</VirtualHost>

<VirtualHost *:8091>
    ServerAdmin [email protected]
    DocumentRoot "/xampp/htdocs/site2"
    ServerName site2.example.com
    ErrorLog "logs/site2-error.log"
    CustomLog "logs/site2-access.log" common
</VirtualHost>

Restart Apache

Open http://localhost:8090/ and http://localhost:8091/

Upvotes: 2

Related Questions