I have followed this guide and am trying to create dynamic vhosts on OSX by allowing foo.dev to direct to the web folder /foo. My difference being that I am using ~/Sites as my web folder instead of the Mac HD as in the guide. It uses dnsmasq which I believe is installed and working correctly.

So in my ~/Sites folder I have:


My httpd-vhosts.conf looks like this:

<Virtualhost *:80>
DocumentRoot "/Users/harryg/Sites/home"
ServerName home.dev
UseCanonicalName Off
ErrorLog "logs/home/error.log"
<Directory "/Users/harryg/Sites/home">
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride None
    Allow from all

<Virtualhost *:80>
VirtualDocumentRoot "/Users/harryg/Sites/sites/%1"
<Directory "/Users/harryg/Sites/sites/%1">
    Options FollowSymLinks
    #Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride None
    Allow from all
ServerName sites.dev
ServerAlias *.dev
UseCanonicalName Off

The first vhost works fine and going to home.dev leads to the example index.php file I have in the root of that vhost.

The 2nd vhost just gives a 403 Forbidden error for anything.dev, whether or not a folder exists for the subdomain of .dev.

Any ideas?


Latest Log entries

Apache Error Log:

[Wed Dec 18 00:45:37 2013] [error] [client] File does not exist: /Users/harryg/Sites/home/favicon.ico
[Wed Dec 18 00:45:45 2013] [error] [client] client denied by server configuration: /Users/harryg/Sites/sites/test/, referer: http://home.dev/
[Wed Dec 18 00:45:45 2013] [error] [client] client denied by server 

Server now works (was a problem with error log directory in config file). But still can't access dynamic vhosts.


What's the content of your 2nd site?

There are two possible reasons:

  1. If a directory has no index document (index.php, index.html, default.html, etc) and directory listing is not allowed, Apache will display a 403 error page.

  2. I notice that you didn't enable ExecCGI in sites.dev . Could you try enable it?

Updated: Percent sign in path (/Users/harryg/Sites/sites/%1) is for mod_vhost_alias, but not Apache's <Directory> rules. Modify this:

<Directory "/Users/harryg/Sites/sites/%1">

To this:

<Directory "/Users/harryg/Sites/sites">

Does it work?

  • Thanks for the suggestions. All my directories have index docs so that shouldn't be the problem. I tried your 2nd suggestion and restarted apache and now nothing works, including localhost and I can ping foo.dev and I get a response which suggests that's dnsmasq doing its thing but I can't figure out why the whole webserver now seems down. (Running apachectl -t gives syntax OK) – harryg Dec 17 '13 at 9:30
  • Can you show us your error.log (its path can be found in httpd.conf, like ErrorLog "logs/error.log")? – ChiChou Dec 17 '13 at 11:47
  • logs posted but nothing from just now. Weirdly apache starts fine and checks out ok in terminal but it might as well not exist now when trying in a web browser – harryg Dec 18 '13 at 0:34
  • As per latest edit, server now works but still no access to dynamic vhosts – harryg Dec 18 '13 at 0:47
  • Try the updated part. P.S. Check out the offcial wiki for this problem: wiki.apache.org/httpd/ClientDeniedByServerConfiguration – ChiChou Dec 18 '13 at 2:02

Just ran into this same issue and it turned out to be a default setting in apache. in the httpd.conf is this

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all

remove the "Deny from all" line and restart apache.


The 403 error states for access denied. You have to check the permissions on the tree directory up to the site directory.

Make sure that the user running apache has read and execute permissions for the directories and read for files.

  • 2
    Somewhat correct. It could also mean that the Apache config is denying access. Remember, Apache 403 forbidden does not automatically translate to file system permissions. – Giacomo1968 Oct 4 '14 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.