关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

Apache下禁止目录浏览的实现方法

发布时间:2021-10-09 11:51:28

在默认情况下没有静态页面入口就是显示现实网站的根目录,这样暴露出来是非常危险的,那么你知道在Apache下如何禁止目录浏览吗?下面“西昆云”小编就去看看Apache下禁止目录浏览的实现方法。

vi /etc/apache/httpd.conf进行编辑httpd.conf文件。
找到Options Indexes FollowSymLinks在Indexes前面加上—符号!如果加+代表允许目录浏览—代表禁止目录浏览。
找到<Directory "/var/www/html/">换成<Directory "/home/httpd">
然后在找到 Options Indexes FollowSymLinks换成Options -Indexes FollowSymLinks
这样的话就属于整个Apache禁止目录浏览了

#
<Directory "/home/httpd">

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
    Options -Indexes FollowSymLinks
这个是配置好的禁止整个Apache浏览

以上就是Apache下禁止目录浏览的实现方法,其实还有很多很多,这里就不一一列举出来了,还有这里的代码可能不全面,有问题的话大家可以留言交流。



/template/Home/Zkeys2/PC/Static