0

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>
Community
  • 1
  • 1
user3186208
  • 85
  • 1
  • 3
  • 10
  • Which version of Apache? As of 2.2 upwards, by default, you define VirtualHosts in the /Apache2.x/conf/extra/httpd-vhosts.conf file rather than the core httpd.conf file **but** you have to ensure that the line `Include conf/extra/httpd-vhosts.conf` is uncommented in core httpd.conf file. You'll probably also need to add a line that points 'wrks.tk' to 127.0.0.1 in /etc/hosts – CD001 Feb 07 '14 at 00:12
  • Do you have a line `Include etc/extra/httpd-vhosts.conf` in the lampp/etc/httpd.conf? is it un-commented? – Moe Tsao Feb 07 '14 at 00:15
  • 1
    Version depends on what you use for `Require all granted` >= 2.4 also Is it not `` and `ServerName www.wrks.tk` and `` just looks abit wrong, but im a linux guy – Lawrence Cherone Feb 07 '14 at 00:16
  • @LozCherone good point about `` - `` should work too (you have to use `_default_` in some instances, running an SSL server for example on port 443 on a Windows box). – CD001 Feb 07 '14 at 00:19

1 Answers1

0

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/

OrderAndChaos
  • 3,547
  • 2
  • 30
  • 57