关于Apache2.4限制目录访问配置的问题

Apache限制目录访问的文章比较多,但是配置了多次也未见成功。根据一些推荐的方法做了如下配置:

#Options None
Options FollowSymLinks
AllowOverride all
Order deny,allow
#Allow from all
Require all denied
连续尝试了一些配置项,输入http://wuhaotian114972378.taobao.com/Admin
不是弄的网站不能访问,就是全部通过。另外一些方法是,直接列出某个项目的
目录来配置禁止访问。但是有多个项目部署在那里,一个个的目录来配置感觉太麻烦。
需要在一个地方配置,所有的目录都不能通过http来访问。
    正在无语的时候,发现了以下的Directory片段,并进行了如下的配置:
DocumentRoot "/tao/bao/wht"
tao/bao/wht
">
#
# 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  FollowSymLinks
#Options Indexes FollowSymLinks
#
# 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
Order deny,allow
Allow from all
#
# Controls who can get stuff from this server.
#
Require all granted
结果发现竟然成功了。输入http://wuhaotian114972378.taobao.com/Admin
显示如下结果(其他页面正常访问):
关于Apache2.4限制目录访问配置的问题_第1张图片
       做了一点猜测:DocumentRoot "/tao/bao/wht"
tao/bao/wht
">
这一段配置在 y />片段之上,之前没有改变 tao/bao/wht"> 时,
所有的目录都通过了,后来再配置的项就无效了。由于Order deny,allow这个配置,使得后面的拒绝所有影响到了
前面片段的通过,所以网站不能访问。
       由于在线上,网站已经被禁了几次,没有再去尝试验证自己的猜测了。
关于Apache2.4限制目录访问配置的问题_第2张图片

你可能感兴趣的:(为了忘却)