Apache禁止直接列出目录和文件
环境
系统:Ubuntu 16.04.4 LTS
apache2:Apache/2.4.18 (Ubuntu)
0x01 禁止直接目录访问
编辑 /etc/apache2/apache2.conf
Options Indexes FollowSymLinks
修改为:
Options FollowSymLinks
修改后结果如下:
1 | <Directory "/var/www/html"> |
注:Indexes表示若当前目录没有index.html就会显示目录结构。
重启Apache服务器
1 | service apache2 restart |
0x02 禁止直接文件访问
// TO DO