Question

My Problem

I've tried many methods, I've researched a ton of questions on StackOverflow and none of them work! Some info:

  • I'm running Snow Leopard OS X (10.6.8)
  • I'm using XAMPP
  • Apache is loading the default (backup) directory. (See bottom of question for what I mean)

Attempt of solving

Here are the websites I've tried:

Adding VirtualHost fails: Access Forbidden Error 403 (XAMPP) (SO)

Xampp vhosts do not work (SO)

Apache Virtual Host is not working right (SO)

Apache VirtualHost not working (SO)

virtual host not working - Apache Web Server forum at WebmasterWorld


Additional Info

My VirtualHosts File:

<VirtualHost wrks.tk:80>
    DocumentRoot "/Apps/XAMPP/htdocs/DNS"
    ServerName wrks.tk
    ErrorLog "/Logs/wrks.tk-error.log"
    CustomLog "/Logs/wrks.tk-access.log" common
    <Directory "/Apps/XAMPP/htdocs/DNS">
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

What it's actually loading (This is the defualt directory in the httpd.conf file, the "backup" directory):

DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/trunk/mod/core.html#options
    # for more information.
    #
    #Options Indexes FollowSymLinks
    # XAMPP
    Options Indexes FollowSymLinks ExecCGI Includes

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    #AllowOverride None
    # since XAMPP 1.4:
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
Was it helpful?

Solution

Couple of things I'd check are:

Making sure you include the httpd-vhosts.conf

# Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

Set up hosts:

navigate to Macintosh HD/private/etc/hosts, in a text editor and click Open. Then add this line:

127.0.0.1    wrks.tk

And maybe try:

<VirtualHost *:80>
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/DNS"
    ServerName wrks.tk
    ErrorLog "/logs/wrks.tk-error_log"
    CustomLog "/logs/wrks.tk-access_log" common
</VirtualHost>

You may also want to set up localhost again.

<VirtualHost *:80>
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
    ServerName localhost
</VirtualHost>

Sorry if some of these paths aren't accurate, you will need to check them against your xamp folder structure.

The simplest implementation I found is this: http://iwearshorts.com/blog/adding-a-virtual-host-vhost-in-xampp-on-a-mac/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top