从“dynamicconfiguration大容量虚拟主机”

我看过阿帕奇loggingdynamicconfiguration大量虚拟主机 ,从我采取

UseCanonicalName Off LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon CustomLog /tmp/access_log vcommon VirtualDocumentRoot /var/www/localhost/htdocs/%0/web VirtualScriptAlias /var/www/localhost/htdocs/%0/web 

我的期望是,对于我的本地开发服务器来说,这将使我无需为每个新域创build一个新的虚拟主机文件。

  1. 为了确保Apache正在拾取文件,我在顶部添加一些垃圾“dlkmvasp”,检查是否出现语法错误,删除垃圾,然后重新启动服务器。
  2. 我添加了几个域到/ etc / hosts,并尝试访问loc.example.com。
  3. “tail -f / tmp / access_log”现在产生“loc.example.com 127.0.0.1 – – [04 / Mar / 2012:11:37:03 +0100]”GET / HTTP / 1.1“403 265”

我如何debugging? 我可以发布所有的虚拟主机configuration是有帮助的,我只是不想开始与墙壁的文字,如果没有必要的话。

既然你得到了403而不是404它看起来像被发现; 你只需要像这样的东西:

 <Directory /var/www/localhost/htdocs> Order allow,deny Allow from all </Directory> 

在您的示例中, loc.example.com将具有/var/www/localhost/htdocs/loc.example.com/webDocumentRoot

检查path/var/www/localhost/htdocs/loc.example.com/webweb目录中的文件是否具有允许Apache访问它们的适当权限。 对于apache需要rx权限的目录,对于需要rx的文件,