[四年前的博客了,学习apache的纯真年代]
学习practical mod_perl中关于apache的配置,章节连接如下
http://www.modperlbook.org/html/4-1-1-Configuration-Files.html
1, ".htaccess"文件,可以看到httpd.conf中有这样的模块
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
如果AllowOverride不是None的话,.htaccess就会出现,其目的是提供resource access control。
可以用AccessFileName .acl将其改为.acl(Access Control List, I guess, lolo)。
如果进行了AccessFileName的修改,不要忘了修改一下模块
<Files .acl> #(估计现在已经改为了FilesMatch了)
Order Allow,Deny
Deny from all
</Files>
默认的本身是:
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
如果不把这个ht*改为AccessFileName修改对应的文件,则可能会露出漏洞。
2,ServerRoot,可以在httpd.conf中找到:
ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.2"
3,Port,现在改名了,叫Listen:
Listen 80
4,<Directory>,<Files>,<Location>,分别对应目录(或者一组目录,用Regex,包含其所有子目录)、一组有相似特性的文件、URL。这里需要注意的就是windows大小写不敏感,Unix敏感。而且,由于这些权限界定可能对相应的资源有交集,如果交集分配的权限不相同的话可能会出现问题,需要注意。
在对应重叠的权限设置时,采用最小先匹配原则。
匹配顺序:
-
<Directory> (except for regular expressions) and .htaccess are processed simultaneously, with the directives in .htaccess overriding<Directory>.
-
<DirectoryMatch> and <Directory ~ > with regular expressions are processed next.
-
<Files> and <FilesMatch> are processed simultaneously.
-
<Location> and <LocationMatch> are processed simultaneously.