linux下对Apache 服务器权限设置命令语法

来源:互联网 发布:建站数据库教程 编辑:程序博客网 时间:2024/06/10 03:16

http://www.usa-idc.com/kb/262.html

 

//对Apache 服务器根的访问不生成目录列表,同时指定错误输出页面
<LocationMatch "^/$>
    Options -Indexes
    ErrorDocument 403 /error/noindex.html
</LocationMatch>
 
//不允许每用户的服务器配置
<IfModule mod_userdir.c>
    UserDir disable
</IfModule>
//当访问服务器时,依次查找页面index.html、index.html.var
DirectoryIndex index.html index.html.var
 
//指定保护目录配置文件的名称
AccessFileName .htaccess
 
//拒绝访问以.ht 开头的文件,即保证.htaccess 不被访问
<Files ~ "^/.ht">
    Order allow,deny
    Deny from all 第 7 章   配置 Apache服务器                                  www.huachu.cn
  209
</Files>
 
//指定负责处理 MIME 对应格式的配置文件的存放位置
TypesConfig /etc/mime.types
//指定默认的MIME 文件类型为纯文本或HTML 文件
DefaultType text/plain
 
//当mod_mime_magic.c 模块被加载时,指定 Magic 信息码配置文件的存放位置
<IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
</IfModule>
 
//只记录连接Apache 服务器的IP 地址,而不记录主机名
HostnameLookups Off
//指定错误日志存放位置
ErrorLog logs/error_log
//指定记录的错误信息的详细等级为 warn 级别
LogLevel warn
//定义四种记录日志的格式
LogFormat "%h %l %u %t /"%r/" %>s %b /"%{Referer}i/" /"%{User-Agent}i/""
combined
LogFormat "%h %l %u %t /"%r/" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
//指定访问日志的记录格式为combined(混合型),并指定访问日志存放位置
CustomLog logs/access_log combined
//设置 Apache 自己产生的页面中使用 Apache 服务器版本的签名
ServerSignature On