使用dnsmasq的VirtualDocumentRoot

时间:2014-09-02 03:55:36

标签: apache osx-mavericks

将本教程http://mallinson.ca/osx-web-development/发送到子文件夹上的所有通配符DNS。我几乎得到了它的设置,但我得到了外卡,禁止403。这是我的vhost文件

<Virtualhost *:80>
    VirtualDocumentRoot "/Users/jcostanzo/Development/www/home"
    ServerName home.dev
    UseCanonicalName Off
    <Directory "/Users/jcostanzo/Development/www/home">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>
</Virtualhost>

<Virtualhost *:80>
    VirtualDocumentRoot "/Users/jcostanzo/Development/www/sites/%1"
    ServerName sites.dev
    ServerAlias *.dev
    UseCanonicalName Off
    <Directory "/Users/jcostanzo/Development/www/sites/%1">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>
</Virtualhost>

所以当我去home.dev时,页面出现了。我进入sites文件夹并创建一个名为tempp的文件夹并添加一个index.php文件。我去了tempp.dev,我得到403被禁止。检查错误日志,我认为我很接近因为它似乎正在拿起正确的URL。

[Mon Sep 01 23:52:24 2014] [error] [client 127.0.0.1] client denied by server configuration: /Users/jcostanzo/Development/www/sites/tempp/
[Mon Sep 01 23:52:24 2014] [error] [client 127.0.0.1] client denied by server configuration: /Users/jcostanzo/Development/www/sites/tempp/favicon.ico

思想?

1 个答案:

答案 0 :(得分:0)

<Directory "/Users/jcostanzo/Development/www/sites/%1">

应该是:

<Directory "/Users/jcostanzo/Development/www/sites/*">

我的猜测是%1在目录指令的上下文中不可用。

#related: