echo ""; echo ""; echo ""; echo ""; if(!is_admin){echo "";} » Apache下进行Web页面访问权限控制 仲子说

2007-04-06

Apache下进行Web页面访问权限控制

Posted in Apache at 21:48 Author:仲远

标签:

???????WISA2007?????????WISA2007????????????????????????????????????????????? Order Deny,Allow ??????????????????????ip??????????????????????????????????????????


???????????????????????????????????

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

??????????????

1???httpd.conf
????????/usr/local/apache/htdocs????????????????????????

AllowOverride All

??????/usr/local/apache/htdocs????????????????.htaccess???????????????????????????????httpd.conf????????????????????????????? AllowOverride All !!!! ????????????????????????

2?????????????.htaccess??
??????phpmyadmin???/usr/local/apache/htdocs????????/usr/local/apache/htdocs/phpmyadmin/???????.htaccess????????

AuthUserFile /usr/local/apache/htdocs/phpmyadmin/.htpasswd
AuthType Basic
AuthName "Protected Area"
ErrorDocument 401 /catchErrors/err_401.html
require valid-user

???????????
(1) ???????/usr/local/apache/htdocs/phpmyadmin/.htpasswd?.
(2) ????????(?????????????).
(3) ErrorDocument ????html??.
(4) ????:????(valid-user)????(valid-group).

3. ????????
???????????:htpasswd(?/usr/local/apache/bin?), ???????????(???MD5??),???????

htpasswd -nb test 123456

???????????????????test????123456???????????????????????????????????/usr/local/apache/htdocs/phpmyadmin/?????.htpasswd??????????????????????????????????htpasswd?????????????????????????????

4. ??apache deamon
/usr/local/apche/bin/apachectl restart

5. ??
?IE??????????http://ip/phpmyadmin/ (????refresh??????)????????????????????????test???123456?????????

本文可以自由转载,转载时请保留全文并注明出处:
转载自仲子说 [ http://www.wangzhongyuan.com/ ]
原文链接:

6 Comments »

  1. Leon.Gao said,

    2007年June20日 at 12:01

    最近在用apache配置一个版本控制软件,想了解一下apache可否控制密码的规则。不知老兄可否有高见。有办法的话mail给我 leon.gao@goertek.com
    or leino11121@163.COM

  2. 仲远 said,

    2007年June20日 at 19:51

    没太理解你想做什么…
    apache权限控制一般只能做对文件夹访问权限的控制吧。更复杂的我也没有做过:)

  3. 皮卡西 said,

    2007年July21日 at 10:38

    文章很精辟,赞一个!
    不过.htaccess其中的”/usr/local/apache/htdocs/phpmyadmin/.htpasswd”替换为”.htpasswd”应该会更加简洁吧~~

  4. 仲远 said,

    2007年July22日 at 22:48

    在Unix中,有许多错误都是由于相对路径问题导致,尤其使用crontab时。为了避免这些错误,所以我比较喜欢使用绝对路径,而且清晰明了一些:)

  5. 彻底屏蔽SosoSpider的方法 仲子说 Apache, Freebsd/Unix服务器, Spiders, 实验室, 搜索引擎, 网络安全, 网络爬虫 蜘蛛 said,

    2008年December4日 at 14:13

    […] 如果你使用的是Apache来提供Web服务,那么可以在Order deny,allow中加入对于这些ip段的访问控制。我曾经在《Apache下进行Web页面访问权限控制》一文中做过详细介绍。以下是我在Apache上设置的访问控制代码,供大家参考: […]

  6. NadiaX said,

    2017年June28日 at 2:16

    I must say you have hi quality articles here.
    Your posts should go viral. You need initial boost only. How to
    get massive traffic? Search for: Murgrabia’s tools go viral

Leave a Comment

*
To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
Click to hear an audio file of the anti-spam word