How to change Virtual Host ?

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

How to change Virtual Host ?

Postby NafeesKhabir » 12. August 2019 19:05

Hello there,

I'm using XAMPP 7.3.7 on Mac OS as this is using VM Im facing following issue with it :
My IP on XAMPP: 192.168.64.9
Issue : Cannot declare Virtual Host Directory
Result Im expecting : I will type cms.test in browser and it will take me to the contents of directory /opt/lampp/htdocs/cms/public

Steps taken :

1. Changed host ip from default mac terminal by adding following in /etc/hosts

192.168.64.9 cms.test

2. Added Virtual Hosts in /opt/lampp/etc/extra httpd-vhosts.conf

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/opt/lampp/htdocs/cms/public"
ServerName cms.test
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>

Result Im getting : when im hitting cms.test it's taking me to root directory I mean to /opt/lampp/htdocs/
NafeesKhabir
 
Posts: 3
Joined: 12. August 2019 18:15
XAMPP version: 7.3.7
Operating System: MAC OS

Re: How to change Virtual Host ?

Postby Nobbie » 12. August 2019 21:45

You probably missed to activate the "include httpd-vhosts.conf" (or similar) in httdp.conf, so your VirtualHost declaration is not executed at all. Per default, httpd-vhosts.conf is NOT included in httpd.conf (it is commented out via "#" in first column). Therefore cms.test simply points to the standard DocumentRoot.
Nobbie
 
Posts: 11211
Joined: 09. March 2008 13:04


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 3 guests