home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / apache_2.2.8-win32-x86-no_ssl.msi / Data1.cab / _42EFB4A51C087F7269BAD9D7864DC1FD < prev    next >
Extensible Markup Language  |  2007-09-01  |  21KB  |  370 lines

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
  4.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  5.               This file is generated from xml source: DO NOT EDIT
  6.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  7.       -->
  8. <title>mod_authz_host - Apache HTTP Server</title>
  9. <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
  10. <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
  11. <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
  12. <link href="../images/favicon.ico" rel="shortcut icon" /></head>
  13. <body>
  14. <div id="page-header">
  15. <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
  16. <p class="apache">Apache HTTP Server Version 2.2</p>
  17. <img alt="" src="../images/feather.gif" /></div>
  18. <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
  19. <div id="path">
  20. <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.2</a> > <a href="./">Modules</a></div>
  21. <div id="page-content">
  22. <div id="preamble"><h1>Apache Module mod_authz_host</h1>
  23. <div class="toplang">
  24. <p><span>Available Languages: </span><a href="../en/mod/mod_authz_host.html" title="English"> en </a> |
  25. <a href="../ja/mod/mod_authz_host.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
  26. <a href="../ko/mod/mod_authz_host.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
  27. </div>
  28. <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Group authorizations based on host (name or IP
  29. address)</td></tr>
  30. <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
  31. <tr><th><a href="module-dict.html#ModuleIdentifier">ModuleáIdentifier:</a></th><td>authz_host_module</td></tr>
  32. <tr><th><a href="module-dict.html#SourceFile">SourceáFile:</a></th><td>mod_authz_host.c</td></tr>
  33. <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.1 and later</td></tr></table>
  34. <h3>Summary</h3>
  35.  
  36.     <p>The directives provided by <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code> are
  37.     used in <code class="directive"><a href="../mod/core.html#directory"><Directory></a></code>,
  38.     <code class="directive"><a href="../mod/core.html#files"><Files></a></code>, and
  39.     <code class="directive"><a href="../mod/core.html#location"><Location></a></code> sections
  40.     as well as <code><a href="core.html#accessfilename">.htaccess</a>
  41.     </code> files to control access to particular parts of the server.
  42.     Access can be controlled based on the client hostname, IP address, or
  43.     other characteristics of the client request, as captured in <a href="../env.html">environment variables</a>. The <code class="directive"><a href="#allow">Allow</a></code> and <code class="directive"><a href="#deny">Deny</a></code> directives are used to
  44.     specify which clients are or are not allowed access to the server,
  45.     while the <code class="directive"><a href="#order">Order</a></code>
  46.     directive sets the default access state, and configures how the
  47.     <code class="directive"><a href="#allow">Allow</a></code> and <code class="directive"><a href="#deny">Deny</a></code> directives interact with each
  48.     other.</p>
  49.  
  50.     <p>Both host-based access restrictions and password-based
  51.     authentication may be implemented simultaneously. In that case,
  52.     the <code class="directive"><a href="../mod/core.html#satisfy">Satisfy</a></code> directive is used
  53.     to determine how the two sets of restrictions interact.</p>
  54.  
  55.     <p>In general, access restriction directives apply to all
  56.     access methods (<code>GET</code>, <code>PUT</code>,
  57.     <code>POST</code>, etc). This is the desired behavior in most
  58.     cases. However, it is possible to restrict some methods, while
  59.     leaving other methods unrestricted, by enclosing the directives
  60.     in a <code class="directive"><a href="../mod/core.html#limit"><Limit></a></code> section.</p>
  61. </div>
  62. <div id="quickview"><h3 class="directives">Directives</h3>
  63. <ul id="toc">
  64. <li><img alt="" src="../images/down.gif" /> <a href="#allow">Allow</a></li>
  65. <li><img alt="" src="../images/down.gif" /> <a href="#deny">Deny</a></li>
  66. <li><img alt="" src="../images/down.gif" /> <a href="#order">Order</a></li>
  67. </ul>
  68. <h3>See also</h3>
  69. <ul class="seealso">
  70. <li><code class="directive"><a href="../mod/core.html#satisfy">Satisfy</a></code></li>
  71. <li><code class="directive"><a href="../mod/core.html#require">Require</a></code></li>
  72. </ul></div>
  73.  
  74. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  75. <div class="directive-section"><h2><a name="Allow" id="Allow">Allow</a> <a name="allow" id="allow">Directive</a></h2>
  76. <table class="directive">
  77. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls which hosts can access an area of the
  78. server</td></tr>
  79. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> Allow from all|<var>host</var>|env=<var>env-variable</var>
  80. [<var>host</var>|env=<var>env-variable</var>] ...</code></td></tr>
  81. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
  82. <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Limit</td></tr>
  83. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
  84. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_authz_host</td></tr>
  85. </table>
  86.     <p>The <code class="directive">Allow</code> directive affects which hosts can
  87.     access an area of the server. Access can be controlled by
  88.     hostname, IP address, IP address range, or by other
  89.     characteristics of the client request captured in environment
  90.     variables.</p>
  91.  
  92.     <p>The first argument to this directive is always
  93.     <code>from</code>. The subsequent arguments can take three
  94.     different forms. If <code>Allow from all</code> is specified, then
  95.     all hosts are allowed access, subject to the configuration of the
  96.     <code class="directive"><a href="#deny">Deny</a></code> and <code class="directive"><a href="#order">Order</a></code> directives as discussed
  97.     below. To allow only particular hosts or groups of hosts to access
  98.     the server, the <em>host</em> can be specified in any of the
  99.     following formats:</p>
  100.  
  101.     <dl>
  102.       <dt>A (partial) domain-name</dt>
  103.  
  104.       <dd>
  105.       <div class="example"><h3>Example:</h3><p><code>
  106.         Allow from apache.org<br />
  107.         Allow from .net example.edu
  108.       </code></p></div>
  109.       <p>Hosts whose names match, or end in, this string are allowed
  110.       access. Only complete components are matched, so the above
  111.       example will match <code>foo.apache.org</code> but it will not
  112.       match <code>fooapache.org</code>. This configuration will cause
  113.       Apache to perform a double reverse DNS lookup on the client IP
  114.       address, regardless of the setting of the <code class="directive"><a href="../mod/core.html#hostnamelookups">HostnameLookups</a></code> directive.  It will do
  115.       a reverse DNS lookup on the IP address to find the associated
  116.       hostname, and then do a forward lookup on the hostname to assure
  117.       that it matches the original IP address.  Only if the forward
  118.       and reverse DNS are consistent and the hostname matches will
  119.       access be allowed.</p></dd>
  120.  
  121.       <dt>A full IP address</dt>
  122.  
  123.       <dd>
  124.       <div class="example"><h3>Example:</h3><p><code>
  125.         Allow from 10.1.2.3<br />
  126.         Allow from 192.168.1.104 192.168.1.205
  127.       </code></p></div>
  128.       <p>An IP address of a host allowed access</p></dd>
  129.  
  130.       <dt>A partial IP address</dt>
  131.  
  132.       <dd>
  133.       <div class="example"><h3>Example:</h3><p><code>
  134.         Allow from 10.1<br />
  135.         Allow from 10 172.20 192.168.2
  136.       </code></p></div>
  137.       <p>The first 1 to 3 bytes of an IP address, for subnet
  138.       restriction.</p></dd>
  139.  
  140.       <dt>A network/netmask pair</dt>
  141.  
  142.       <dd>
  143.       <div class="example"><h3>Example:</h3><p><code>
  144.         Allow from 10.1.0.0/255.255.0.0
  145.       </code></p></div>
  146.       <p>A network a.b.c.d, and a netmask w.x.y.z. For more
  147.       fine-grained subnet restriction.</p></dd>
  148.  
  149.       <dt>A network/nnn CIDR specification</dt>
  150.  
  151.       <dd>
  152.       <div class="example"><h3>Example:</h3><p><code>
  153.         Allow from 10.1.0.0/16
  154.       </code></p></div>
  155.       <p>Similar to the previous case, except the netmask consists of
  156.       nnn high-order 1 bits.</p></dd>
  157.     </dl>
  158.  
  159.     <p>Note that the last three examples above match exactly the
  160.     same set of hosts.</p>
  161.  
  162.     <p>IPv6 addresses and IPv6 subnets can be specified as shown
  163.     below:</p>
  164.  
  165.     <div class="example"><p><code>
  166.        Allow from 2001:db8::a00:20ff:fea7:ccea<br />
  167.        Allow from 2001:db8::a00:20ff:fea7:ccea/10
  168.     </code></p></div>
  169.  
  170.     <p>The third format of the arguments to the
  171.     <code class="directive">Allow</code> directive allows access to the server
  172.     to be controlled based on the existence of an <a href="../env.html">environment variable</a>. When <code>Allow from
  173.     env=<var>env-variable</var></code> is specified, then the request is
  174.     allowed access if the environment variable <var>env-variable</var>
  175.     exists. The server provides the ability to set environment
  176.     variables in a flexible way based on characteristics of the client
  177.     request using the directives provided by
  178.     <code class="module"><a href="../mod/mod_setenvif.html">mod_setenvif</a></code>. Therefore, this directive can be
  179.     used to allow access based on such factors as the clients
  180.     <code>User-Agent</code> (browser type), <code>Referer</code>, or
  181.     other HTTP request header fields.</p>
  182.  
  183.     <div class="example"><h3>Example:</h3><p><code>
  184.       SetEnvIf User-Agent ^KnockKnock/2\.0 let_me_in<br />
  185.       <Directory /docroot><br />
  186.       <span class="indent">
  187.         Order Deny,Allow<br />
  188.         Deny from all<br />
  189.         Allow from env=let_me_in<br />
  190.       </span>
  191.       </Directory>
  192.     </code></p></div>
  193.  
  194.     <p>In this case, browsers with a user-agent string beginning
  195.     with <code>KnockKnock/2.0</code> will be allowed access, and all
  196.     others will be denied.</p>
  197.  
  198. </div>
  199. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  200. <div class="directive-section"><h2><a name="Deny" id="Deny">Deny</a> <a name="deny" id="deny">Directive</a></h2>
  201. <table class="directive">
  202. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls which hosts are denied access to the
  203. server</td></tr>
  204. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> Deny from all|<var>host</var>|env=<var>env-variable</var>
  205. [<var>host</var>|env=<var>env-variable</var>] ...</code></td></tr>
  206. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
  207. <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Limit</td></tr>
  208. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
  209. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_authz_host</td></tr>
  210. </table>
  211.     <p>This directive allows access to the server to be restricted
  212.     based on hostname, IP address, or environment variables. The
  213.     arguments for the <code class="directive">Deny</code> directive are
  214.     identical to the arguments for the <code class="directive"><a href="#allow">Allow</a></code> directive.</p>
  215.  
  216. </div>
  217. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  218. <div class="directive-section"><h2><a name="Order" id="Order">Order</a> <a name="order" id="order">Directive</a></h2>
  219. <table class="directive">
  220. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls the default access state and the order in which
  221. <code class="directive">Allow</code> and <code class="directive">Deny</code> are
  222. evaluated.</td></tr>
  223. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> Order <var>ordering</var></code></td></tr>
  224. <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Order Deny,Allow</code></td></tr>
  225. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
  226. <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Limit</td></tr>
  227. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
  228. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_authz_host</td></tr>
  229. </table>
  230.  
  231.     <p>The <code class="directive">Order</code> directive, along with the
  232.     <code class="directive"><a href="#allow">Allow</a></code> and <code class="directive"><a href="#deny">Deny</a></code> directives, controls a
  233.     three-pass access control system. The first pass processes either
  234.     all <code class="directive"><a href="#allow">Allow</a></code> or all
  235.     <code class="directive"><a href="#deny">Deny</a></code> directives, as
  236.     specified by the <code class="directive">Order</code> directive. The second
  237.     pass parses the rest of the directives (<code class="directive"><a href="#deny">Deny</a></code> or <code class="directive"><a href="#allow">Allow</a></code>). The third pass applies
  238.     to all requests which do not match either of the first two.</p>
  239.  
  240.     <p>Note that all <code class="directive"><a href="#allow">Allow</a></code> and <code class="directive"><a href="#deny">Deny</a></code> directives are processed,
  241.     unlike a typical firewall, where only the first match is used. The
  242.     last match is effective (also unlike a typical firewall).
  243.     Additionally, the order in which lines appear in the configuration
  244.     files is not significant -- all <code class="directive"><a href="#allow">Allow</a></code> lines are processed as one
  245.     group, all <code class="directive"><a href="#deny">Deny</a></code> lines
  246.     are considered as another, and the default state is considered by
  247.     itself.</p>
  248.  
  249.     <p><em>Ordering</em> is one of:</p>
  250.  
  251.     <dl>
  252.       <dt><code>Allow,Deny</code></dt>
  253.  
  254.       <dd>First, all <code class="directive"><a href="#allow">Allow</a></code> directives are
  255.       evaluated; at least one must match, or the request is rejected.
  256.       Next, all <code class="directive"><a href="#deny">Deny</a></code>
  257.       directives are evaluated. If any matches, the request is rejected.
  258.       Last, any requests which do not match an <code class="directive"><a href="#allow">Allow</a></code> or a <code class="directive"><a href="#deny">Deny</a></code> directive are denied by
  259.       default.</dd>
  260.  
  261.       <dt><code>Deny,Allow</code></dt>
  262.  
  263.       <dd>First, all <code class="directive"><a href="#deny">Deny</a></code>
  264.       directives are evaluated; if any match, the request is denied
  265.       <strong>unless</strong> it also matches an <code class="directive"><a href="#allow">Allow</a></code> directive. Any requests
  266.       which do not match any <code class="directive"><a href="#allow">Allow</a></code> or <code class="directive"><a href="#deny">Deny</a></code> directives are
  267.       permitted.</dd>
  268.  
  269.       <dt><code>Mutual-failure</code></dt>
  270.  
  271.       <dd>This order has the same effect as <code>Order
  272.       Allow,Deny</code> and is deprecated in its favor.</dd>
  273.     </dl>
  274.  
  275.     <p>Keywords may only be separated by a comma; <em>no whitespace</em>
  276.     is allowed between them.</p>
  277.  
  278.     <table class="bordered">
  279.       <tr>
  280.         <th>Match</th>
  281.         <th>Allow,Deny result</th>
  282.         <th>Deny,Allow result</th>
  283.       </tr><tr>
  284.         <th>Match Allow only</th>
  285.         <td>Request allowed</td>
  286.         <td>Request allowed</td>
  287.       </tr><tr>
  288.         <th>Match Deny only</th>
  289.         <td>Request denied</td>
  290.         <td>Request denied</td>
  291.       </tr><tr>
  292.         <th>No match</th>
  293.         <td>Default to second directive: Denied</td>
  294.         <td>Default to second directive: Allowed</td>
  295.       </tr><tr>
  296.         <th>Match both Allow & Deny</th>
  297.         <td>Final match controls: Denied</td>
  298.         <td>Final match controls: Allowed</td>
  299.       </tr>
  300.     </table>
  301.  
  302.     <p>In the following example, all hosts in the apache.org domain
  303.     are allowed access; all other hosts are denied access.</p>
  304.  
  305.     <div class="example"><p><code>
  306.       Order Deny,Allow<br />
  307.       Deny from all<br />
  308.       Allow from apache.org
  309.     </code></p></div>
  310.  
  311.     <p>In the next example, all hosts in the apache.org domain are
  312.     allowed access, except for the hosts which are in the foo.apache.org
  313.     subdomain, who are denied access. All hosts not in the apache.org
  314.     domain are denied access because the default state is to <code class="directive"><a href="#deny">Deny</a></code> access to the server.</p>
  315.  
  316.     <div class="example"><p><code>
  317.       Order Allow,Deny<br />
  318.       Allow from apache.org<br />
  319.       Deny from foo.apache.org
  320.     </code></p></div>
  321.  
  322.     <p>On the other hand, if the <code class="directive">Order</code> in the
  323.     last example is changed to <code>Deny,Allow</code>, all hosts will
  324.     be allowed access. This happens because, regardless of the actual
  325.     ordering of the directives in the configuration file, the
  326.     <code>Allow from apache.org</code> will be evaluated last and will
  327.     override the <code>Deny from foo.apache.org</code>. All hosts not in
  328.     the <code>apache.org</code> domain will also be allowed access
  329.     because the default state is <code class="directive"><a href="#allow">Allow</a></code>.</p>
  330.  
  331.     <p>The presence of an <code class="directive">Order</code> directive can
  332.     affect access to a part of the server even in the absence of
  333.     accompanying <code class="directive"><a href="#allow">Allow</a></code>
  334.     and <code class="directive"><a href="#deny">Deny</a></code> directives
  335.     because of its effect on the default access state. For example,</p>
  336.  
  337.     <div class="example"><p><code>
  338.       <Directory /www><br />
  339.       <span class="indent">
  340.         Order Allow,Deny<br />
  341.       </span>
  342.       </Directory>
  343.     </code></p></div>
  344.  
  345.     <p>will Deny all access to the <code>/www</code> directory
  346.     because the default access state is set to
  347.     <code class="directive"><a href="#deny">Deny</a></code>.</p>
  348.  
  349.     <p>The <code class="directive">Order</code> directive controls the order of
  350.     access directive processing only within each phase of the server's
  351.     configuration processing. This implies, for example, that an
  352.     <code class="directive"><a href="#allow">Allow</a></code> or <code class="directive"><a href="#deny">Deny</a></code> directive occurring in a
  353.     <code class="directive"><a href="../mod/core.html#location"><Location></a></code> section
  354.     will always be evaluated after an <code class="directive"><a href="#allow">Allow</a></code> or <code class="directive"><a href="#deny">Deny</a></code> directive occurring in a
  355.     <code class="directive"><a href="../mod/core.html#directory"><Directory></a></code>
  356.     section or <code>.htaccess</code> file, regardless of the setting of
  357.     the <code class="directive">Order</code> directive. For details on the
  358.     merging of configuration sections, see the documentation on <a href="../sections.html">How Directory, Location and Files sections
  359.     work</a>.</p>
  360.  
  361. </div>
  362. </div>
  363. <div class="bottomlang">
  364. <p><span>Available Languages: </span><a href="../en/mod/mod_authz_host.html" title="English"> en </a> |
  365. <a href="../ja/mod/mod_authz_host.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
  366. <a href="../ko/mod/mod_authz_host.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
  367. </div><div id="footer">
  368. <p class="apache">Copyright 2007 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
  369. <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
  370. </body></html>