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

📄 690-693.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Special Edition Using Linux, Fourth Edition:Configuring Apache</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0789717468//-->

<!--TITLE=Special Edition Using Linux, Fourth Edition//-->

<!--AUTHOR=Jack Tackett//-->

<!--AUTHOR=Jr.//-->

<!--AUTHOR=Steve Burnett//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Que//-->

<!--CHAPTER=36//-->

<!--PAGES=690-693//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="688-690.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="693-695.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P>In many cases, be it for consistency or just plain old security reasons, you&#146;ll want to have the directory indexing engine just ignore certain types of files, such as <TT>emacs</TT> backup files or files beginning with a. (hidden files). The <TT>IndexIgnore</TT> directive allows you to specify the types of files to ignore when creating a directory index. The default setting is this:</P>

<!-- CODE SNIP //-->

<PRE>

IndexIgnore */.??* *~ *# */HEADER* */README* */RCS

</PRE>

<!-- END CODE SNIP //-->

<P>This line might look cryptic, but it&#146;s basically a space-separated list of patterns. The first pattern matches against any. file that&#146;s longer than three characters. This way, the link to the higher-up directory (..) can still work. The second (<TT>*~</TT>) and third (<TT>*#</TT>) patterns are common for matching old <TT>emacs</TT> backup files. The next patterns are to avoid listing the same files used for <TT>HeaderName</TT> and <TT>ReadmeName</TT>. The last (<TT>*/RCS</TT>) is given because many sites use RCS, a software package for revision control maintenance, which stores its extra (rather sensitive) information in RCS directories.</P>

<P>Finally, you get to two very interesting directives for controlling the last set of options regarding directory indexing. The first is <TT>AddDescription</TT>, which works similarly to <TT>AddIcon</TT>:</P>

<!-- CODE SNIP //-->

<PRE>

AddDescription <I>description filename</I> [<I>filename</I>]&#133;

</PRE>

<!-- END CODE SNIP //-->

<P>For example,

</P>

<!-- CODE SNIP //-->

<PRE>

AddDescription "My cat" /private/cat.gif

</PRE>

<!-- END CODE SNIP //-->

<P>As elsewhere, <I>filename</I> can actually be a pattern, so you can have</P>

<!-- CODE SNIP //-->

<PRE>

AddDescription "An MPEG Movie Just For You!" *.mpg

</PRE>

<!-- END CODE SNIP //-->

<P>Finally, you have the granddaddy of all options-setting directives, the smorgasbord of functionality control&#151;<TT>IndexOptions</TT>. The syntax is simple:</P>

<!-- CODE SNIP //-->

<PRE>

IndexOptions <I>option</I> [<I>option</I>]&#133;

</PRE>

<!-- END CODE SNIP //-->

<P>Table 36.2 lists the available options.

</P>

<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 36.2</B> Available Options for IndexOptions

<TR>

<TH COLSPAN="2"><HR>

<TR>

<TH WIDTH="35%" ALIGN="LEFT">Option

<TH WIDTH="65%" ALIGN="LEFT">Explanation

<TR>

<TH COLSPAN="2"><HR>

<TR>

<TD VALIGN="TOP"><TT>FancyIndexing</TT>

<TD>This option is the same as the separate <TT>FancyIndexing</TT> directive. (Sorry to confuse everyone, but backward compatibility demands bizarre things sometimes!)

<TR>

<TD VALIGN="TOP"><TT>IconsAreLinks</TT>

<TD>If this option is set, the icon will be clickable as a link to whatever resource the entry it&#146;s associated with links to. In other words, the icon becomes part of the hyperlink.

<TR>

<TD VALIGN="TOP"><TT>ScanHTMLTitles</TT>

<TD>When given a listing for an HTML file, the server will open the HTML file and parse it to obtain the value of the <TT>&lt;TITLE&gt;</TT> field in the HTML document, if it exists. This can put a pretty heavy load on the server, because it&#146;s a lot of disk accessing and some amount of CPU to extract the title from the HTML. Thus, it&#146;s not recommended unless you know you have the capacity.

<TR>

<TD><TT>SuppressDescription</TT>, <TT>SuppressLastModified</TT>, <TT>SuppressSize</TT>

<TD>These will suppress their respective fields (Description, Last Modified, and Size). Normally, each of those is a field in the output listings.

<TR>

<TD COLSPAN="2"><HR>

</TABLE>

<P>By default, none of these <TT>IndexOptions</TT> is turned on. The options don&#146;t <I>merge</I>, which means that when you&#146;re setting these on a per-directory basis by using access.conf or .htaccess files, setting the options for a more specific directory requires resetting the complete options listing. For example, envision the following in your access configuration file:</P>

<!-- CODE SNIP //-->

<PRE>

&lt;Directory /pub/docs/&gt;

IndexOptions ScanHTMLTitles

&lt;/Directory&gt;

&lt;Directory /pub/docs/others/&gt;

IndexOptions IconsAreLinks

&lt;/Directory&gt;

</PRE>

<!-- END CODE SNIP //-->

<P>Directory listings done in or below the second directory, /pub/docs/others/, wouldn&#146;t have <TT>ScanHTMLTitles</TT> set. Why? Well, you figured administrators would need to be able to disable an option they had set globally in a specific directory. This was simpler than writing NOT logic into the options listings.</P>

<P>If you run into problems getting directory indexing to work, make sure that the settings you have for the <TT>Options</TT> directive in the access config files allow for directory indexing in that directory. Specifically, the <TT>Options</TT> directive must include <TT>Indexing</TT>. What&#146;s more, if you&#146;re using .htaccess files to set things such as <TT>AddDescription</TT> or <TT>AddIcon</TT>, the <TT>AllowOverride</TT> directive must include <TT>FileInfo</TT> in its list of options.</P>

<H4 ALIGN="LEFT"><A NAME="Heading8"></A><FONT COLOR="#000077">User Directories</FONT></H4>

<P>Sites with many users sometimes prefer to be able to give their users access to managing their own parts of the Web tree in their own directories, using the URL semantics of

</P>

<!-- CODE SNIP //-->

<PRE>

<A HREF="http://myhost.com/~user/">http://myhost.com/~user/</A>

</PRE>

<!-- END CODE SNIP //-->

<P>where <TT><I>~user</I></TT> is actually an alias to a directory in the user&#146;s home directory. This is different from the <TT>Alias</TT> directive, which could map only a particular pseudo-directory into an actual directory. In this case, you want <I>~user</I> to map to something like /home/user/public_html. Because the number of &#147;users&#148; can be very high, some sort of macro is useful here. That macro is the <TT>UserDir</TT> directive.</P>

<P>With <TT>UserDir</TT>, you specify the subdirectory within the users&#146; home directories where they can put content, which is mapped to the <I>~user</I> URL. So in other words, the default</P>

<!-- CODE SNIP //-->

<PRE>

UserDir public_html

</PRE>

<!-- END CODE SNIP //-->

<P>will cause a request for

</P>

<!-- CODE SNIP //-->

<PRE>

<A HREF="http://myhost.com/~dave/index.html">http://myhost.com/~dave/index.html</A>

</PRE>

<!-- END CODE SNIP //-->

<P>to cause a lookup for the UNIX file

</P>

<!-- CODE SNIP //-->

<PRE>

/home/dave/public_html/index.html

</PRE>

<!-- END CODE SNIP //-->

<P>presuming that /home/dave is Dave&#146;s home directory.

</P>

<H3><A NAME="Heading9"></A><FONT COLOR="#000077">Special Modules</FONT></H3>

<P>Most of the functionality that distinguishes Apache from the competition has been implemented as modules to the Apache API. This has been extremely useful in allowing functionality to evolve separately from the rest of the server, and for allowing for performance tuning. The following sections cover that extra functionality in detail.

</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="688-690.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="693-695.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

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