⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 core.html.en

📁 Apache官方在今天放出产品系列2.2的最新版本2.2.11的源码包 最流行的HTTP服务器软件之一
💻 EN
📖 第 1 页 / 共 5 页
字号:
    <p>There will be times when the server is asked to provide a    document whose type cannot be determined by its <a class="glossarylink" href="../glossary.html#mime-type" title="see glossary">MIME types</a> mappings.</p>    <p>The server SHOULD inform the client of the content-type of the    document.  If the server is unable to determine this by normal    means, it will set it to the configured    <code>DefaultType</code>. For example:</p>    <div class="example"><p><code>      DefaultType image/gif    </code></p></div>    <p>would be appropriate for a directory which contained many GIF    images with filenames missing the <code>.gif</code> extension.</p>    <p>In cases where it can neither be determined by the server nor    the administrator (e.g. a proxy), it is preferable to omit the MIME    type altogether rather than provide information that may be false.    This can be accomplished using</p>    <div class="example"><p><code>      DefaultType None    </code></p></div>    <p><code>DefaultType None</code> is only available in httpd-2.2.7 and later.</p>    <p>Note that unlike <code class="directive"><a href="#forcetype">ForceType</a></code>, this directive only    provides the default mime-type. All other mime-type definitions,    including filename extensions, that might identify the media type    will override this default.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="Directory" id="Directory">&lt;Directory&gt;</a> <a name="directory" id="directory">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose a group of directives that apply only to thenamed file-system directory and sub-directories</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;Directory <var>directory-path</var>&gt;... &lt;/Directory&gt;</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">&lt;Directory&gt;</code> and    <code>&lt;/Directory&gt;</code> are used to enclose a group of    directives that will apply only to the named directory and    sub-directories of that directory. Any directive that is allowed    in a directory context may be used. <var>Directory-path</var> is    either the full path to a directory, or a wild-card string using    Unix shell-style matching. In a wild-card string, <code>?</code> matches    any single character, and <code>*</code> matches any sequences of    characters. You may also use <code>[]</code> character ranges. None    of the wildcards match a `/' character, so <code>&lt;Directory    /*/public_html&gt;</code> will not match    <code>/home/user/public_html</code>, but <code>&lt;Directory    /home/*/public_html&gt;</code> will match. Example:</p>    <div class="example"><p><code>      &lt;Directory /usr/local/httpd/htdocs&gt;<br />      <span class="indent">        Options Indexes FollowSymLinks<br />      </span>      &lt;/Directory&gt;    </code></p></div>    <div class="note">      <p>Be careful with the <var>directory-path</var> arguments:      They have to literally match the filesystem path which Apache uses      to access the files. Directives applied to a particular      <code>&lt;Directory&gt;</code> will not apply to files accessed from      that same directory via a different path, such as via different symbolic      links.</p>    </div>    <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular    expressions</a> can also be used, with the addition of the    <code>~</code> character. For example:</p>    <div class="example"><p><code>      &lt;Directory ~ "^/www/.*/[0-9]{3}"&gt;    </code></p></div>    <p>would match directories in <code>/www/</code> that consisted of    three numbers.</p>    <p>If multiple (non-regular expression) <code class="directive">&lt;Directory&gt;</code> sections    match the directory (or one of its parents) containing a document,    then the directives are applied in the order of shortest match    first, interspersed with the directives from the <a href="#accessfilename">.htaccess</a> files. For example,    with</p>    <div class="example"><p><code>      &lt;Directory /&gt;<br />      <span class="indent">        AllowOverride None<br />      </span>      &lt;/Directory&gt;<br />      <br />      &lt;Directory /home/&gt;<br />      <span class="indent">        AllowOverride FileInfo<br />      </span>      &lt;/Directory&gt;    </code></p></div>    <p>for access to the document <code>/home/web/dir/doc.html</code>    the steps are:</p>    <ul>      <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>      &lt;Directory ~ abc$&gt;<br />      <span class="indent">        # ... directives here ...<br />      </span>      &lt;/Directory&gt;    </code></p></div>    <p>the regular expression section won't be considered until after    all normal <code class="directive">&lt;Directory&gt;</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">&lt;Directory&gt;</code> will    be applied.</p>   <p><strong>Note that the default Apache access for    <code>&lt;Directory /&gt;</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>      &lt;Directory /&gt;<br />      <span class="indent">        Order Deny,Allow<br />        Deny from All<br />      </span>      &lt;/Directory&gt;    </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">&lt;Directory&gt;</code> directives    cannot nest, and cannot appear in a <code class="directive"><a href="#limit">&lt;Limit&gt;</a></code> or <code class="directive"><a href="#limitexcept">&lt;LimitExcept&gt;</a></code> section.</p><h3>See also</h3><ul><li><a href="../sections.html">How &lt;Directory&gt;,    &lt;Location&gt; and &lt;Files&gt; 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">&lt;DirectoryMatch&gt;</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>&lt;DirectoryMatch <var>regex</var>&gt;... &lt;/DirectoryMatch&gt;</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">&lt;DirectoryMatch&gt;</code> and    <code>&lt;/DirectoryMatch&gt;</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">&lt;Directory&gt;</a></code>. However, it    takes as an argument a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular     expression</a>. For example:</p>    <div class="example"><p><code>      &lt;DirectoryMatch "^/www/(.+/)?[0-9]{3}"&gt;    </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">&lt;Directory&gt;</a></code> fora description of how regular expressions are mixed in with normal<code class="directive">&lt;Directory&gt;</code>s</li><li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt; and&lt;Files&gt; 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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -