zoukankan      html  css  js  c++  java
  • AllowOverride以及Options相关指令

         httpd.conf是Apache的主要配置文件,但是针对每个目录,apache还允许在它们各自的目录下放置一个叫做.htacess的文件,用于控制这个目录的属性。
         通 常利用Apache的rewrite模块对URL进行重写的时候,rewrite规则会写在.htaccess文件里。但要使apache 能够正常的读 取.htaccess 文件的内容,就必须对.htaccess所在目录进行配置。从安全性考虑,根目录的AllowOverride属性一般都配置成 “None”,不允许任何Override ,即:
        < Directory />
            AllowOverride None
        < /Directory>  

        在 AllowOverride 设置为 None 时,.htaccess 文件将被完全忽略。当此指令设置为All时,所有具有“.htaccess” 作用域的指令都允许出现在.htaccess 文件中。
        而对于 URL rewrite 来说,至少需要把目录设置为

        < Directory /blogRoot/>
             AllowOverride FileInfo
        < /Directory>  

    AllowOverride 参数就是指明Apache服务器是否去找.htacess文件作为配置文件,如果设置为none,那么服务器将忽略. htacess文件,如果设置为 All,那么所有在.htaccess文件里有的指令都将被重写。对于AllowOverride,还可以对它指定如下一些能被重写的指令类型.
      1 AuthConfig    允许使用所有的权限指令,他们包括 AuthDBMGroupFile  AuthDBMUserFile  AuthGroupFile  AuthName  AuthTypeAuthUserFile 和 Require
      2 FileInfo    允许使用文件控制类型的指令。它们包括 AddEncoding  AddLanguage  AddType  DEfaultType  ErrorDocument  LanguagePriority
      3 Indexes    允 许使用目录控制类型的指令。它们包 括 AddDescription  AddIcon AddIconByEncoding AddIconByType DefaultIcon DirectoryIndex FancyIndexing HeaderName IndexIgnore IndexOptions ReadmeName
      4 Limit    允许使用权限控制指令。它们包括Allow Deny和Order
      5 Options    允许使用控制目录特征的指令.他们包括Options 和XBitHack
     
      Options:

      1 All    准许以下除MultiViews以外所有功能
      2 MultiViews    允许多重内容被浏览,如果你的目录下有一个叫做foo.txt的文件,那么你可以通过/foo来访问到它,这对于一个多语言内容的站点比较有用
      3 Indexes    若该目录下无index文件,则准许显示该目录下的文件以供选择,禁止目录浏览可以删这项或“-Indexes”。
        例子:
        

      <Directory />
            Options -Indexes FollowSymLinks //或者写为“Options FollowSymLinks”
            AllowOverride None
            Order deny,allow
            Deny from all
      </Directory>

      4 IncludesNOEXEC    准许SSI,但不可使用#exec和#include功能
      5 Includes    准许SSI
      6 FollowSymLinks    在该目录中,服务器将跟踪符号链接。注意,即使服务器跟踪符号链接,它也不会改变用来匹配不同区域的路径名,如果在<Local>标记内设置,该选项会被忽略
      7 SymLinksIfOwnerMatch    在该目录中仅仅跟踪本站点内的链接
      8 ExecCGI    在该目录下准许使用CGI
     
    ---------------------

      配置文件中的一段代码:
     

       <Directory /MyBlogRoot/>
           AllowOverride None
       </Directory> 

    <完>

  • 相关阅读:
    How to function call using 'this' inside forEach loop
    jquery.validate.unobtrusive not working with dynamic injected elements
    Difference between jQuery.extend and jQuery.fn.extend?
    Methods, Computed, and Watchers in Vue.js
    Caution using watchers for objects in Vue
    How to Watch Deep Data Structures in Vue (Arrays and Objects)
    Page: DOMContentLoaded, load, beforeunload, unload
    linux bridge
    linux bridge
    EVE-NG网卡桥接
  • 原文地址:https://www.cnblogs.com/liluxiang/p/9453060.html
Copyright © 2011-2022 走看看