Options -Indexes
,取消列出目錄檔案。
[root@kvm8 ~]# vim /etc/httpd/conf/httpd.conf <Directory "/var/www/html"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory>
[root@kvm5 ~]# mkdir /var/www/html/inx [root@kvm5 ~]# echo 'index test' > /var/www/html/inx/i.html [root@kvm5 ~]# echo 'index test' > /var/www/html/inx/ijk.html
[root@kvm5 ~]# curl -s http://kvm5.deyu.wang/inx/ | sed -e 's/<[^>]*>//g' -e '/^$/d' Index of /inx Index of /inx NameLast modifiedSizeDescription Parent Directory - i.html 2015-05-23 00:32 11 ijk.html 2015-05-23 00:33 11
[root@kvm8 ~]# vim /etc/httpd/conf/httpd.conf <Directory "/var/www/html"> Options -Indexes +FollowSymLinks AllowOverride None Require all granted </Directory>
[root@kvm5 ~]# systemctl reload httpd.service
[root@kvm5 ~]# curl -s http://kvm5.deyu.wang/inx/ | sed -e 's/<[^>]*>//g' -e '/^$/d' 403 Forbidden Forbidden You don't have permission to access /inx/ on this server.