²©¿Íͳ¼ÆÐÅÏ¢

Óû§Ãû£ºlovejuan007
ÎÄÕÂÊý£º702
ÆÀÂÛÊý£º76
·ÃÎÊÁ¿£º384468
ÎÞÓDZңº2555
²©¿Í»ý·Ö£º4160
²©¿ÍµÈ¼¶£º7
×¢²áÈÕÆÚ£º2009-12-10

½ûÖ¹ÏÔʾApacheĿ¼Áбí-Indexes FollowSymLinks
2010-12-15 14:51:53

½ûÖ¹ÏÔʾApacheĿ¼Áбí-Indexes FollowSymLinks

ÈçºÎÐÞ¸ÄĿ¼µÄÅäÖÃÒÔ½ûÖ¹ÏÔʾ Apache Ŀ¼ÁÐ±í¡£

ȱʡÇé¿öÏÂÈç¹ûÄãÔÚä¯ÀÀÆ÷ÊäÈëµØÖ·£º

http://localhost:8080/

Èç¹ûÄãµÄÎļþ¸ùĿ¼ÀïÓÐ index.html£¬ä¯ÀÀÆ÷¾Í»áÏÔʾ index.htmlµÄÄÚÈÝ£¬Èç¹ûûÓÐ index.html£¬ä¯ÀÀÆ÷¾Í»áÏÔʾÎļþ¸ùĿ¼µÄĿ¼ÁÐ±í£¬Ä¿Â¼Áбí°üÀ¨Îļþ¸ùĿ¼ÏµÄÎļþºÍ×ÓĿ¼¡£

ͬÑùÄãÊäÈëÒ»¸öÐéÄâĿ¼µÄµØÖ·£º

http://localhost:8080/b/

Èç¹û¸ÃÐéÄâĿ¼ÏÂûÓÐ index.html£¬ä¯ÀÀÆ÷Ò²»áÏÔʾ¸ÃÐéÄâĿ¼µÄĿ¼½á¹¹£¬Áгö¸ÃÐéÄâĿ¼ÏµÄÎļþºÍ×ÓĿ¼¡£

ÈçºÎ½ûÖ¹ Apache ÏÔʾĿ¼ÁбíÄØ£¿

Òª½ûÖ¹ Apache ÏÔʾĿ¼½á¹¹ÁÐ±í£¬Ö»Ð轫 Option ÖÐµÄ Indexes È¥µô¼´¿É¡£

±ÈÈçÎÒÃÇ¿´¿´Ò»¸öĿ¼µÄĿ¼ÅäÖãº

<Directory "D:/Apa/blabla">
    Options Indexes FollowSymLinks #---------->Options  FollowSymLinks 
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

ÄãÖ»ÐèÒª½«ÉÏÃæºìÉ«´úÂëÖÐµÄ Indexes È¥µô£¬¾Í¿ÉÒÔ½ûÖ¹ Apache ÏÔʾ¸ÃĿ¼½á¹¹¡£Óû§¾Í²»»á¿´µ½¸ÃĿ¼ÏµÄÎļþºÍ×ÓĿ¼ÁбíÁË¡£

Indexes µÄ×÷ÓþÍÊǵ±¸ÃĿ¼ÏÂûÓÐ index.html Îļþʱ£¬¾ÍÏÔʾĿ¼½á¹¹£¬È¥µô Indexes£¬Apache ¾Í²»»áÏÔʾ¸ÃĿ¼µÄÁбíÁË¡£

µÚ¶þÖÖ·½·¨
½â¾ö°ì·¨£º
        1¡¢±à¼­httpd.confÎļþ
            vi ./conf/httpd.conf

   ÕÒµ½ÈçÏÂÄÚÈÝ£º
          ……
          <Directory “C:/Program Files/Apache2.2/htdocs”>
              #
              # Possible values for the Options directive are “None”, “All”,
              # or any combination of:
                 Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
              #
              # Note that “MultiViews” must be named *explicitly* — “Options All”
              # doesn’t give it to you.
              #
              # The Options directive is both complicated and important. Please see
              # http://httpd.apache.org/docs/2.2/mod/core.html#options
              # for more information.
              #
              Options Indexes FollowSymLinks

              #
              # AllowOverride controls what directives may be placed in .htaccess files.
              # It can be “All”, “None”, or any combination of the keywords:
              #   Options FileInfo AuthConfig Limit
              #
              AllowOverride None

              #
              # Controls who can get stuff from this server.
              #
              Order allow,deny
              Allow from all

          </Directory>
          ……

   ÔÚOptions Indexes FollowSymLinksÔÚIndexesÇ°Ãæ¼ÓÉÏ – ·ûºÅ¡£
        ¼´£º Options -Indexes FollowSymLinks
   ¡¾±¸×¢£ºÔÚIndexesǰ£¬¼Ó + ´ú±íÔÊÐíĿ¼ä¯ÀÀ£»¼Ó – ´ú±í½ûֹĿ¼ä¯ÀÀ¡£¡¿

    ÕâÑùµÄ»°¾ÍÊôÓÚÕû¸öApache½ûֹĿ¼ä¯ÀÀÁË¡£

    Èç¹ûÊÇÔÚÐéÄâÖ÷»úÖУ¬Ö»ÒªÔö¼ÓÈçÏÂÐÅÏ¢¾ÍÐУº
           <Directory “D:\test”>
             Options -Indexes FollowSymLinks
             AllowOverride None
             Order deny,allow
             Allow from all
         </Directory>
     ÕâÑùµÄ»°¾Í½ûÖ¹ÔÚtest¹¤³ÌϽøÐÐĿ¼ä¯ÀÀ¡£

±¸×¢£º ÇмÇĪ°Ñ“Allow from all”¸Ä³É “Deny from all”£¬·ñÔò£¬Õû¸öÍøÕ¾¶¼²»Äܱ»´ò¿ª¡£
   <Finished>

 »¹ÓÐÒ»ÖÖ·½·¨£º

¿ÉÒÔÔÚ¸ùĿ¼µÄ .htaccess ÎļþÖÐÊäÈë

  1. <Files *>
  2. Options -Indexes
  3. </Files>

¾Í¿ÉÒÔ×èÖ¹Apache ½«Ä¿Â¼½á¹¹Áбí³öÀ´¡£

 

·ÖÏíÖÁ
¸ü¶à
Ò»¼üÊղأ¬ËæÊ±²é¿´£¬·ÖÏíºÃÓÑ£¡
0ÈË
ÁËÕâÆªÎÄÕÂ
Àà±ð£ºLinux©ª¼¼ÊõȦ()©ªÔĶÁ()©ªÆÀÂÛ() ©ª ÍÆË͵½¼¼ÊõȦ©ª·µ»ØÊ×Ò³

ÎÄÕÂÆÀÂÛ

 
 

·¢±íÆÀÂÛ            

¡¾¼¼ÊõÃÅÕר¼Ò½âÎö£ºÈí¿¼ÖØµãÄѵ㼰ӦÊÔ¼¼ÇÉ
êÇ  ³Æ£º
µÇ¼  ¿ìËÙ×¢²á
ÑéÖ¤Â룺

Çëµã»÷ºóÊäÈëÑéÖ¤Â벩¿Í¹ý2¼¶£¬ÎÞÐèÌîдÑéÖ¤Âë

ÄÚ  ÈÝ£º