Can't set up XAMPP virtual host on Mac

Joined
Nov 7, 2013
Messages
1
Reaction score
0
Points
1
Hi

I have been trying to set up virtual host on XAMPP on my mac but I can't get it to work!

When I go to http://z I see the content of /Applications/XAMPP/htdocs while it is supposed to show the content of /Applications/XAMPP/vhosts/z.

What I have done so far:
- Stop MAc server
- Restart XAMPP
- Edit /Application/XAMPP/etc/httpd.conf (for document root and incuding /Applications/XAMPP/etc/extra/httpd-vhosts.conf file

- Edit /etc/hosts
- Edit httpd-vhosts.conf

===================


Code:
bash-3.2# sudo apachectl stop
Code:
bash-3.2# /Applications/XAMPP/xamppfiles/xampp restart
Restarting XAMPP for Mac OS X 1.7.3...
XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...not running.
XAMPP: Stopping ProFTPD...not running.
XAMPP: Starting Apache...already running.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
/Applications/XAMPP/etc/extra
Code:
bash-3.2# cat httpd-vhosts.conf 
#
# Virtual Hosts

NameVirtualHost *:80
<VirtualHost _default_:80>
        DocumentRoot "/Applications/XAMPP/htdocs/"
</VirtualHost>

<VirtualHost *:80>
        DocumentRoot "/Applications/XAMPP/vhosts/z"
        ServerName z
        ErrorLog "/Applications/XAMPP/vhosts/z/local-error.log"
        <Directory "/Applications/XAMPP/vhosts/z">
                Allow from all
                AllowOverride All
                Require all granted
        </Directory>
</VirtualHost>
/etc/hosts
Code:
bash-3.2# cat hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost 
fe80::1%lo0	localhost

127.0.0.1	activate.adobe.com
220.244.223.153 	au.yahoo.com www.yahoo.com yahoo.com yahoo.com.au
#Added by XAMPP Control
127.0.0.1 192-168-1-6.tpgi.com.au


192.168.1.1	pocket.wifi
127.0.0.1 192-168-1-3.tpgi.com.au

#Added by XAMPP Control
127.0.0.1 192-168-1-3.tpgi.com.au

127.0.0.1 z


#Added by XAMPP Control
127.0.0.1 192-168-1-4.tpgi.com.au

bash-3.2#
/Applications/XAMPP/etc/httpd.conf/
Code:
DocumentRoot "/Applications/XAMPP/xamppfiles/vhosts"

# Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
A few points:
1 - It is using with the /etc/hosts file (not /Applications/XAMPP/etc/hosts).
2 - When I go to http://z I see the content of /Applications/XAMPP/htdocs. This means the only thing that is working is the /etc/hosts file and virtual host set up is being ignored!
3 -http://localhost shows the content of /Applications/XAMPP/htdocs
4 - http://vhosts goes to Google.com
5 - Also why did you ask me to use /etc/hosts and not /Applications/XAMPP/etc/hosts?



Can anyone tell me what I am doing wrong?

Than kyou.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top