How to disable directory indexing from apache2 whe

2019-04-05 04:06发布

I need to disable that indexing when I enter on my root directory on a apache2 server, any tips?

4条回答
SAY GOODBYE
2楼-- · 2019-04-05 04:34

If it's only one directory that you want to protect from viewing contents, you can also just add an index.html or index.php that will show whenever someone browses to that directory.

查看更多
时光不老,我们不散
3楼-- · 2019-04-05 04:43

Make sure that you also add -Indexes to the config files in your sites-enabled (or sites-available as it was in my case) directory, they're usually inside the "/etc/apache2/" directory.

查看更多
时光不老,我们不散
4楼-- · 2019-04-05 04:56

Usually done like this:

Options -Indexes

The minus means "no"...

查看更多
ゆ 、 Hurt°
5楼-- · 2019-04-05 05:01

Edit your apache2 configuration file which normally is on the dir: "/etc/apache2/httpd.conf".

Add the following or edit if your already have some configurations for the default web server dir (/var/www):

 <Directory /var/www>
   Options -Indexes
   AllowOverride All
   Order allow,deny
   Allow from all
 </Directory>

This will disable the indexing to all the public directories.

查看更多
登录 后发表回答