📄 core.html.en
字号:
<li>Apply directive <code>AllowOverride None</code> (disabling <code>.htaccess</code> files).</li> <li>Apply directive <code>AllowOverride FileInfo</code> (for directory <code>/home</code>).</li> <li>Apply any <code>FileInfo</code> directives in <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and <code>/home/web/dir/.htaccess</code> in that order.</li> </ul> <p>Regular expressions are not considered until after all of the normal sections have been applied. Then all of the regular expressions are tested in the order they appeared in the configuration file. For example, with</p> <div class="example"><p><code> <Directory ~ abc$><br /> <span class="indent"> # ... directives here ...<br /> </span> </Directory> </code></p></div> <p>the regular expression section won't be considered until after all normal <code class="directive"><Directory></code>s and <code>.htaccess</code> files have been applied. Then the regular expression will match on <code>/home/abc/public_html/abc</code> and the corresponding <code class="directive"><Directory></code> will be applied.</p> <p><strong>Note that the default Apache access for <code><Directory /></code> is <code>Allow from All</code>. This means that Apache will serve any file mapped from an URL. It is recommended that you change this with a block such as</strong></p> <div class="example"><p><code> <Directory /><br /> <span class="indent"> Order Deny,Allow<br /> Deny from All<br /> </span> </Directory> </code></p></div> <p><strong>and then override this for directories you <em>want</em> accessible. See the <a href="../misc/security_tips.html">Security Tips</a> page for more details.</strong></p> <p>The directory sections occur in the <code>httpd.conf</code> file. <code class="directive"><Directory></code> directives cannot nest, and cannot appear in a <code class="directive"><a href="#limit"><Limit></a></code> or <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section.</p><h3>See also</h3><ul><li><a href="../sections.html">How <Directory>, <Location> and <Files> sections work</a> for an explanation of how these different sections are combined when a request is received</li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="DirectoryMatch" id="DirectoryMatch"><DirectoryMatch></a> <a name="directorymatch" id="directorymatch">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose directives that apply tofile-system directories matching a regular expression and theirsubdirectories</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><DirectoryMatch <var>regex</var>>... </DirectoryMatch></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr></table> <p><code class="directive"><DirectoryMatch></code> and <code></DirectoryMatch></code> are used to enclose a group of directives which will apply only to the named directory and sub-directories of that directory, the same as <code class="directive"><a href="#directory"><Directory></a></code>. However, it takes as an argument a regular expression. For example:</p> <div class="example"><p><code> <DirectoryMatch "^/www/(.+/)?[0-9]{3}"> </code></p></div> <p>would match directories in <code>/www/</code> that consisted of three numbers.</p><h3>See also</h3><ul><li><code class="directive"><a href="#directory"><Directory></a></code> fora description of how regular expressions are mixed in with normal<code class="directive"><Directory></code>s</li><li><a href="../sections.html">How <Directory>, <Location> and<Files> sections work</a> for an explanation of how these differentsections are combined when a request is received</li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="DocumentRoot" id="DocumentRoot">DocumentRoot</a> <a name="documentroot" id="documentroot">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory that forms the main document tree visiblefrom the web</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DocumentRoot <var>directory-path</var></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DocumentRoot /usr/local/apache/htdocs</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr></table> <p>This directive sets the directory from which <code class="program"><a href="../programs/httpd.html">httpd</a></code> will serve files. Unless matched by a directive like <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>, the server appends the path from the requested URL to the document root to make the path to the document. Example:</p> <div class="example"><p><code> DocumentRoot /usr/web </code></p></div> <p>then an access to <code>http://www.my.host.com/index.html</code> refers to <code>/usr/web/index.html</code>.</p> <p>The <code class="directive">DocumentRoot</code> should be specified without a trailing slash.</p><h3>See also</h3><ul><li><a href="../urlmapping.html">Mapping URLs to FilesystemLocation</a></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="EnableMMAP" id="EnableMMAP">EnableMMAP</a> <a name="enablemmap" id="enablemmap">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use memory-mapping to read files during delivery</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableMMAP On|Off</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableMMAP On</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr></table> <p>This directive controls whether the <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use memory-mapping if it needs to read the contents of a file during delivery. By default, when the handling of a request requires access to the data within a file -- for example, when delivering a server-parsed file using <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> -- Apache memory-maps the file if the OS supports it.</p> <p>This memory-mapping sometimes yields a performance improvement. But in some environments, it is better to disable the memory-mapping to prevent operational problems:</p> <ul> <li>On some multiprocessor systems, memory-mapping can reduce the performance of the <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</li> <li>With an NFS-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code>, the <code class="program"><a href="../programs/httpd.html">httpd</a></code> may crash due to a segmentation fault if a file is deleted or truncated while the <code class="program"><a href="../programs/httpd.html">httpd</a></code> has it memory-mapped.</li> </ul> <p>For server configurations that are vulnerable to these problems, you should disable memory-mapping of delivered files by specifying:</p> <div class="example"><p><code> EnableMMAP Off </code></p></div> <p>For NFS mounted files, this feature may be disabled explicitly for the offending files by specifying:</p> <div class="example"><p><code> <Directory "/path-to-nfs-files"> <span class="indent"> EnableMMAP Off </span> </Directory> </code></p></div></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="EnableSendfile" id="EnableSendfile">EnableSendfile</a> <a name="enablesendfile" id="enablesendfile">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use the kernel sendfile support to deliver files to the client</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableSendfile On|Off</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableSendfile On</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.44 and later</td></tr></table> <p>This directive controls whether <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use the sendfile support from the kernel to transmit file contents to the client. By default, when the handling of a request requires no access to the data within a file -- for example, when delivering a static file -- Apache uses sendfile to deliver the file contents without ever reading the file if the OS supports it.</p> <p>This sendfile mechanism avoids separate read and send operations, and buffer allocations. But on some platforms or within some filesystems, it is better to disable this feature to avoid operational problems:</p> <ul> <li>Some platforms may have broken sendfile support that the build system did not detect, especially if the binaries were built on another box and moved to such a machine with broken sendfile support.</li> <li>On Linux the use of sendfile triggers TCP-checksum offloading bugs on certain networking cards when using IPv6.</li> <li>With a network-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code> (e.g., NFS or SMB), the kernel may be unable to serve the network file through its own cache.</li> </ul> <p>For server configurations that are vulnerable to these problems, you should disable this feature by specifying:</p> <div class="example"><p><code> EnableSendfile Off </code></p></div> <p>For NFS or SMB mounted files, this feature may be disabled explicitly for the offending files by specifying:</p> <div class="example"><p><code>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -