ºìÁªLinuxÃÅ»§
Linux°ïÖú

¹ØÓÚApache·þÎñÆ÷ÈçºÎʵÏÖÓû§ÑéÖ¤

·¢²¼Ê±¼ä:2006-08-30 12:34:50À´Ô´:ºìÁª×÷Õß:coolentboy
¡¡¡¡Apache·þÎñÆ÷ÒѾ­ÄÚÖÃÓû§ÑéÖ¤»úÖÆ£¬´ó¼ÒÖ»ÒªÊʵ±µÄ¼ÓÒÔÉèÖ㬱ã¿ÉÒÔ¿ØÖÆÍøÕ¾µÄijЩ²¿·ÖÒªÓû§ÑéÖ¤¡£´ó¼ÒÖ»Òª¸ú×ÅÎÒÒ»²½²½×öÏÂÀ´¾ÍÓ¦¸ÃÄÜÇáËÉʵÏÖÓû§ÑéÖ¤¡£

¡¡¡¡Ç°ÆÚ×¼±¸£¬±ØÐëÒѾ­°²×°apache£¬Èç¹û»¹Ã»°²×°£¬»òÕ߶԰²×°ºÜÄ£ºýµÄ»°£¬Çë²éѯÏàÓ¦µÄ×ÊÁÏ¡£

µÚ1²½

¡¡¡¡ÎÒÃÇÔÚ/var/www(apacheµÄÖ÷Ò³¸ùĿ¼)Ͻ¨Á¢Ò»¸ötestĿ¼

[code]mkdir /var/www/test[/code]

µÚ2²½

¡¡¡¡È»ºóÎÒÃDZ༭httpd.conf

¡¡¡¡Ìí¼Ó

[code]Alias /test"/var/www/test"

Options Indexes MultiViews
AllowOverride AuthConfig #±íʾ½øÐÐÉí·ÝÑéÖ¤
Order allow,deny
Allow from all

#AllowOverride AuthConfig ±íʾ½øÐÐÉí·ÝÑéÖ¤ ÕâÊǹؼüµÄÉèÖÃ[/code]

µÚ3²½

ÔÚ/var/www/test´´½¨.htaccessÎļþ
[code]vi /var/www/test/.htaccess
AuthName "frank share web"
AuthType Basic
AuthUserFile /var/www/test/.htpasswd
require valid-user
#AuthName ÃèÊö£¬Ëæ±ãд
#AuthUserFile /var/www/test/.htpasswd
#require valid-user »òÕß require user frank ÏÞÖÆÊÇËùÓкϷ¨Óû§»¹ÊÇÖ¸¶¨Óû§[/code]

¡¡¡¡#ÃÜÂëÎļþÍƼöʹÓÃ.htpasswd,ÒòΪapacheĬÈÏϵͳ¶Ô¡°.ht¡±¿ªÍ·µÄÎļþĬÈϲ»ÔÊÐíÍⲿ¶ÁÈ¡£¬°²È«ÏµÊý»á¸ßÒ»µãŶ¡£

µÚ4²½

¡¡¡¡¾ÍÊÇ´´½¨apacheµÄÑéÖ¤Óû§

[code]htpasswd -c /var/www/test/.htpasswd frank[/code]

¡¡¡¡#µÚÒ»´Î´´½¨Óû§ÒªÓõ½-c ²ÎÊý µÚ2´ÎÌí¼ÓÓû§£¬¾Í²»ÓÃ-c²ÎÊý

¡¡¡¡Èç¹ûÄãÃÇÏëÐÞ¸ÄÃÜÂ룬¿ÉÒÔÈçÏÂ

[code]htpasswd -m .htpasswd frank[/code]

µÚ5²½

¡¡¡¡ok£¬ÖØÆôapache·þÎñ£¬È»ºó·ÃÎÊ http://ÄãµÄÍøÕ¾µØÖ·/test Èç¹û˳ÀûµÄ»°£¬Ó¦¸ÃÄÜ¿´µ½Ò»¸öÓû§ÑéÖ¤µÄµ¯³ö´°¿Ú£¬Ö»ÒªÌîÈëµÚ4²½´´½¨µÄÓû§ÃûºÍÃÜÂë¾ÍÐÐ

¡¡¡¡ºó»°£¬ÎªÁË·þÎñÆ÷µÄÐÔÄÜ£¬Ò»°ã²»ÍƼöʹÓÃAllowOverride AuthConfig»òÕßAllowOverride ALL£¬ÒòΪÕâ»áʹ·þÎñÆ÷»á²»¶ÏµÄȥѰÕÒ.htaccess,´Ó¶øÓ°Ïì·þÎñÆ÷µÄЧÄÜ£¬Ò»°ãÎÒÃÇ°ÑһЩºǫ́¹ÜÀí½çÃæ»òÕßÆäËûÌØÊâĿ¼¿ÉÄÜÐèÒª¼ÓÑéÖ¤Õâ¸öÐèÇó¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 2 ÌõÆÀÂÛ

  1. shyboy8688 ÓÚ 2006-09-01 23:09:27·¢±í:

    ÇëÎÊ£º¼ÈÈ»ÉÏÃæµÄÅäÖÃÖÐÓõ½ÁË.htaccess , ÏÂÃæÕâ¸öÅäÖÃÊDz»ÊÇÒ²¸Ãд½øÈ¥ÄØ~
    AccessFireName .htaccess

    Order allow,deny
    Deny from all

  2. kk125 ÓÚ 2006-08-30 21:53:37·¢±í:

    ллÌṩ£¬²»´í!!Ö§³Ö!!