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 :
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 cms.test

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

<VirtualHost *:80>
DocumentRoot "/opt/lampp/htdocs/cms/public"
ServerName cms.test
ErrorLog "logs/"
CustomLog "logs/" common

Result Im getting : when im hitting cms.test it's taking me to root directory I mean to /opt/lampp/htdocs/
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.
Posts: 11768
Joined: 09. March 2008 13:04

Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 6 guests