美文网首页
Apache禁止目录浏览

Apache禁止目录浏览

作者: Zero_R | 来源:发表于2019-02-13 00:15 被阅读0次

当访问Apache中某个项目的某个目录,会将该目录下的文件列出来,并不安全

修改Apache配置文件httpd.conf:

DocumentRoot  "C:\phpStudy\WWW"
<Directory />
    Options +Indexes +FollowSymLinks +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
</Directory>
将第3行的Options -Indexes +FollowSymLinks +ExecCGI中的+Indexes改为-Indexes
在Indexes前加+代表允许目录浏览,加-代表禁止目录浏览。之后访问不存在默认首页的目录将显示HTTP 403错误页面。

相关文章

网友评论

      本文标题:Apache禁止目录浏览

      本文链接:https://www.haomeiwen.com/subject/nxoleqtx.html