Apache2选项索引

我正在试验Apache和Option Indexes。 我mv index.html到no_filename。 当我去www.dunno.com时,我得到了一个被禁止的网页,而不是我期待的目录列表。 为什么是这样? 我在httpd.conf中安装并启用了mod_autoindex:

<VirtualHost *:80> Servername www.dunno.com DocumentRoot /var/www/web1 <Directory "/var/www/web1"> Options Indexes Order allow,deny Allow from all </Directory> </VirtualHost> 

 Options +Indexes 

确保底层文件系统权限允许运行Apache的用户/组访问必要的文件夹/文件。

目录是否可读? 您需要在目录(chmod 0555或chmod a + rx)上设置“r”和“x”位,供用户读取目录列表。

核实:

  1. 找出用户运行的httpd(在不同的系统上是不同的)
  2. 成为该用户:“sudo -u www bash”如果用户是“www”
  3. 确保你可以“cd”那个目录和“ls -l”的工作。