网站运维:xampp的Apache设置禁止访问网站目录

1、进入apache的配置文件 httpd.conf 找到:

<Directory "C:/xampp/htdocs">
    #
    # 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.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

2、修改

把 Options Indexes FollowSymLinks Includes ExecCGI那行,改成

#Options Indexes FollowSymLinks Includes ExecCGI
Options FollowSymLinks Includes ExecCGI

就是将Indexes去掉,Indexes表示若当前目录没有index.html就会显示目录结构。

重启Apache服务器

3、修改前

在这里插入图片描述

4、修改后

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43731793/article/details/93857682
今日推荐