2
votes

I am new to Xampp, I just downloaded version 7.4.9, and I am having a hard time getting the virtual hosts to work. Here are the steps I have followed...

  1. Uncommenting 'Include etc/extra/httpd-vhosts.conf' in the httpd.config fil for Apache.

  2. In the httpd-vhosts file I entered

<VirtualHost *:80>
    ServerAdmin **************
    DocumentRoot "/opt/lampp/htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin **************
    DocumentRoot "/opt/lampp/htdocs/vhost_test"
    ServerName vhost_test
</VirtualHost>
  1. In my /etc/hosts file I added a line that said '127.0.0.1. vhost_test

I have tried to follow many tutorials, so this is the most basic steps I have working. The first Virtual Host works because I can use it to redirect the localhost location. The second one does not. Please help!!!

1

1 Answers

0
votes

You are doing the right steps, however the ip has to be the ip of your XAMPP installation. Launch the xampp server and it shows you a custom ip address, you need to use that in /etc/hosts file.

enter image description here

Also remember that there should be no dot at the end of the ip address. So it will be something like this:

/etc/hosts file of your mac:

192.168.40.2 vhost_test

The method of 127.0.0.1 works for the previous versions on mac, however latest version sets up a linux environment and thus we have to hook our hosts file to the ip address of that linux.