????4?????÷?????????????
??????????Apache?????????????????????????ServerName????????÷??????????????????ServerName????У????????????????????д???????????????????????????????????????IP?????????"ServerName 192.168.0.94:80"??
????5????????????·??
????Apache?????????????·???"/var/www/html"???????????????????????????????У???????????????·?????????????????????????á??????????Apache??????????·???????"/home/lk/www"?????????httpd.conf????н??????????DocumentRoot "/home/www"??
????6????????????
?????????????????????????????Web????IP????????????????????Web??棬????????????????????????£?Apache???????????index.html??????????DirectoryIndex?????ж??壬??????httpd.conf?????"DirectoryIndex index.html index.html.var"?????????????????DirectoryIndex?????????????????????????
????????ж?????????????????????????????з???Apache???????????????????????DirectoryIndex???????????????????????????1????????1???????????????????2????????????????????index.htm??index.php?????????????????????????httpd.conf????"DirectoryIndex index.html index.htm index.php index.html.var"??
????7????????????
?????????????????????????????????Web??????????????????????????????????????????
??????1???????????????????????Apache??????????????????????????Apache??????????????????????????????????????????????error_log????????????????λ?ú?????????????ErrorLog???????????á?????"ErrorLog logs/erroe_log"??????????????·????????"/"???????????·?????????ServerRoot???????·????
??????2??????????????????????????????????е???????????????????????????????????????????????????Щ????????????????????????????access_log????????????????λ?ú?????????????CustomLog?????????????????"CustomLog logs/access_log combined"??
?????????????????????У?combined???????????????????λ????????common????combined??????common?????? Web??????????????????????????????????????????????????????combined??????????????????common????combined??????????????????????????????????????????
????8??????????????
????AddDefaultCharset????????????????????????????????????????????Apache????????????????????UTF-8????????????????????????????????????????????????????????"AddDefaultCharset UTF-8"???"AddDefaultCharset GB2312"????????????Apache?????????????????????????????
???????????????????
????1????????????
????Apache?????????????????????????????????????????????(??????????????
?????????????"default"?????л????????:
????<Directory />
????Options FollowSymLinks
????AllowOverride None
????</Directory>
??????????????????????????????????????????????????????????????????
???????磺
<Directory "D:/www_root">
#
# ???????? "None"?? "All"?? ?????е????? "Indexes"??
# "Includes"?? "FollowSymLinks"?? "ExecCGI"?? ?? "MultiViews".
# ???"MultiViews"??????????--- "Options All"?????????????
#
Options Indexes FollowSymLinks MultiViews
#
# ?????????????Щ.htaccess?????????
# ??????? "All"???????????????"Options"?? "FileInfo"??
# "AuthConfig"?? "Limit"
#
AllowOverride None
#
# ??????Щ????????????????????
#
Order allow??deny
Allow from all
</Directory>
?????????
????allow??deny????????apache??conf???????.htaccess????У????Directory?? Location?? Files??????????????????????????????
?????????????????
????Order Deny??Allow
????Allow from All
???????“Deny??Allow”?м???????????????????????????п??????????????Сд??????????趨??????????趨“???????趨????н???????????”????????????Deny???????н????????趨??????????????з???????????????????????????????????????????????????????????
???????????????????????趨????????????????
????Order Allow??Deny
????Deny from All
??????????????????????????????????????
????Order Deny??Allow
????Deny from ip1 ip2
????????
????Order Allow??Deny
????Allow from all
????Deny from ip1 ip2
????apache????order???????????????????????????????????????????allow??????????????????order??allow??????????????????????deny????????????????????ip1??ip2???????????????order??????“??”???????????????????????????????????????
????Order Deny??Allow
????Allow from all
????Deny from domain.org
????????????????domain.org??????????deny????????apache???????????allow?????????????????????????????????????????Order Allow??Deny?????????????????ɡ?
????Order Allow??Deny
????Allow from ip1
????Deny from all
???????????????????ip1??????????????????????趨??allow????????order??deny???????????????deny??????????????Χ?????????????ip1??all include ip1???????????е?????????????????????????????????????????????
????Order Deny??Allow
????Deny from all
????Allow from ip1
????С????????order deny??allow???deny????????allow????????order allow??deny???allow????????deny????????
????????????????????
???????????????????????????????/opt/www/lk?£?????????????/var/www/html?2???????????????????
???????????????????????????????????μ??????????????λ??Apache????????????????????????????????????????????????web??????????????????????????????????????????????????????????????????????????У??????????????????????????????????????????λ??????????web??????
??????????Alias???????????????
????Alias /bbs/ "/opt/www/lk/"
????<Directory "/opt/www/lk/">
????Options Indexes MultiViews
????AllowOverride None
????Order allow??deny
????Allow from all
????</Directory>
???????????????????
???????????????簲??м?????????????????????????????????????????????????????е??????????????????????á?Apache?????????????????????????????????????????????????Apache???????????????????????
????????????????????????в?????
????Alias /bbs/ "/opt/www/lk/"
????<Directory "/opt/www/lk/">
????Options Indexes MultiViews
????AllowOverride None
????Order allow??deny
????Allow from all
????AuthType??Basic
????AuthName "welcome go home:"
????AuthUserFile /etc/httpd/authpwd
????Require user laoda laoer
????</Directory>
?????????
????AuthType?????????????????????????????mod_auth????Basic??
????AuthName??Web?????????????????????????????????????
????AuthUserFile????????????htpasswd??·????
????Require user?????????????????????????????????????
???????????authpwd???????????????touch /etc/httpd/authpwd
??????????????????????д??????????????δ??????????-c????????????????????????д????????????????????
????[root@localhost http]#htpasswd -c /etc/httpd/authpwd laoda
????New password:
????Re-type new password:
????Add password for user laoda
????[root@localhost http]#htpasswd /etc/httpd/authpwd laoer
????New password:
????Re-type new password:
????Add password for user laoer
????????service httpd restart??????????????????linux??IP??????ɡ?