我configuration了下面的vhost:
<VirtualHost *:80> DocumentRoot /var/www/myvhost ServerName myv.host.com ServerAlias myv.host.com ErrorLog logs/myvhost-error_log CustomLog logs/myvhost-access_log combined ServerAdmin [email protected] <Directory /var/www/myvhost> AllowOverride All Options +Indexes </Directory> </VirtualHost>
从apachectl工具的angular度来看,configuration看起来是正确的。
但是,我无法获得该虚拟主机上的目录列表:
Forbidden You don't have permission to access / on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
错误日志显示如下:
[Wed Mar 07 19:23:33 2012] [error] [client 66.6.145.214] Directory index forbidden by Options directive: /var/www/******
最近,以下是现在踢入error.log:
[Wed Mar 07 20:16:10 2012] [error] [client 192.152.243.233] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/error/noindex.html
今天,以下是被踢出去的:
[Thu Mar 08 14:05:56 2012] [error] [client 66.6.145.214] Directory index forbidden by Options directive: /var/www/<mydir> [Thu Mar 08 14:05:56 2012] [error] [client 66.6.145.214] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/error/noindex.html [Thu Mar 08 14:05:57 2012] [error] [client 66.6.145.214] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
这是在修改vhosts.conf文件之后:
<VirtualHost *:80> DocumentRoot /var/www/<mydir> ServerName myhost ServerAlias myhost ErrorLog logs/myhost-error_log CustomLog logs/myhost-access_log combined ServerAdmin admin@myhost <Directory "/var/www/<mydir>"> Options All +Indexes +FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
什么不见了?
根目录下的所有子目录都正确地执行了目录列表 – 它只是根目录不能。
403代表资源被find。 检查一下apache是否具有rx文件根目录及其上的所有目录的权限,以及其中的文件。
尝试改变你的目录指令
<Directory /var/www/myvhost> AllowOverride All Options +Indexes Order allow,deny Allow from all </Directory>
今天我遇到了类似的问题,我发现上面显示的错误类似:
[Wed Oct 17 14:19:08 2012] [error] [client 123.66.66.22] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/mysite/
有+/-的混合选项是有问题的,请注意关于选项的apache文档 :
将带有+或 – 的选项与带有这些选项的选项混合是无效的语法,并且将在服务器启动时通过语法检查而被中止拒绝。
另外,有效使用不带+/-的指令的效果会删除该目录的所有其他先前设置的指令。
我使用了没有+的索引,并且有上面我复制的错误。
既然你说你没有使用任何.htaccess文件,为什么不改变目录指令呢:
<Directory /var/www/myvhost> AllowOverride None Options +Indexes Order allow,deny Allow from all </Directory>
index.html文件 我仍然想知道为什么我不能只遍历目录本身,但现在这是工作。
在我的CentOS 5/6/7系统上,这个问题是由系统随附的默认/etc/httpd/conf.d/welcome.conf中的某种冲突引起的。 将每一行welcome.conf注释掉,并重新启动Web服务器结果,使目录索引在webroot中可见。 至less在Red Hat / CentOS系统上,它似乎只是缺省networking服务器configuration中的一个缺陷,但也可能是其他的。 您的系统可能遇到类似的问题。