CentOS 6.2禁用httpd autoindex

我试图禁用在Apacheconfiguration的目录的自动索引。

<VirtualHost *:80> ServerName example.com ServerAlias www.example.com example.co.uk www.example.co.uk DocumentRoot /var/www/sites/example.com/public ErrorLog /var/log/httpd/error.log CustomLog /var/log/httpd/access.log combined Options -Indexes </VirtualHost> 

Options -Indexes放入VirtualHostconfiguration中会禁用这些目录中的autoindex吗?

是的,通过在Options -Indexes禁用整个VirtualHost的autoindex。

如果您想了解更多信息,请参阅Apache Core Features文档。