httpd的访控

  • 设置在/var/www/html 没有默认目录是访问时不显示文件列表
#


#
# 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.2/mod/core.html#options
# for more information.
#
    Options -Indexes FollowSymLinks
#表示在没有默认主页情况下以文件列表方式显示文件;如果显示就  Options -Indexes FollowSymLinks 这样就不会显示了或者把此行注
释掉

                                                                                                       355,5         34%
  • 重启服务
    [root@root html]# service httpd restart
  • 客户端访问不会显示了
httpd的访控_第1张图片

设置自定义网页目录的如guo

  • 设置访问控制
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/app/www/html"
#设置网页的家目录; 更改家目录为/app/www/html

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories). 
#
# First, we configure the "default" to be a very restrictive set of 
# features.  
#

    Options FollowSymLinks
    AllowOverride None


#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
#

Options Indexes FollowSymLinks
#Indexes定义了/app/www/html 网页主目录没有,就会显示文件目录;默认是关闭的;None
#FollowSymLinks 是定义允许软连接;不加默认是允许的;
#None是全部禁止;All全部允许

#

测试

httpd的访控_第2张图片

是否允许在


Options Indexes
#定义了/app/www/html 网页主目录没有,就会显示文件目录
AllowOverride All
#这个指令定义了是否允许在数据目录下创建.与访问控制相关的哪些指令可以放在指定目录下的.htaccess (由AccessFileName 指定)文
件中,覆盖之前的配置指令只对 语句有效AllowOverride All:  所有指令都有效AllowOverride None :.htaccess  文件无>
效AllowOverride AuthConfig Indexes  除了AuthConfig和Indexes

限制来源地址访问的资源

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#

#定义了以.ht开头的文件是否访用户看到 
   Order allow,deny 
#定义允许拒绝生效顺序
    Deny from all
#表示拒绝所有;他支持的参数有deny from 172.16. 100.100 allow from 172.16
    Satisfy All

定制日志的信息

httpd的访控_第3张图片
httpd的访控_第4张图片
  • 自己定义日志格式

httpd的访控_第5张图片

字符集格式

支持的字符集有
中文字符集:GBK, GB2312, GB18030


httpd的访控_第6张图片

你可能感兴趣的:(httpd的访控)