838-841.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 181 行
HTML
181 行
<HTML>
<HEAD>
<TITLE>Linux Unleashed, Third Edition:Configuring a WWW Site</TITLE>
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0672313723//-->
<!--TITLE=Linux Unleashed, Third Edition//-->
<!--AUTHOR=Tim Parker//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Sams//-->
<!--CHAPTER=51//-->
<!--PAGES=838-841//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="836-838.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="841-843.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P>The next configuration file to check is <TT>srm.conf</TT>, which is used to handle the server resources. The variables that have to be checked or set in the <TT>srm.conf</TT> file are as follows:</P>
<CENTER>
<TABLE WIDTH="80%"><TR>
<TD WIDTH="40%" VALIGN="TOP"><TT>AccessFileName</TT>
<TD WIDTH="60%">The file that gives access permissions (default is <TT>.htaccess</TT>).
<TR>
<TD VALIGN="TOP"><TT>AddDescription</TT>
<TD>Provides a description of a type of file. For example, an entry could be <TT>AddDescription PostScript file *.ps</TT>. Multiple entries are allowed.
<TR>
<TD VALIGN="TOP"><TT>AddEncoding</TT>
<TD>Indicates that files with a particular extension are encoded somehow, such as <TT>AddEncoding compress Z</TT>. Multiple entries are allowed.
<TR>
<TD VALIGN="TOP"><TT>AddIcon</TT>
<TD>Gives the name of the icon to display for each type of file.
<TR>
<TD VALIGN="TOP"><TT>AddIconType</TT>
<TD>Uses <TT>MIME</TT> type to determine the icon to use.
<TR>
<TD VALIGN="TOP"><TT>AddType</TT>
<TD>Overrides <TT>MIME</TT> definitions for extensions.
<TR>
<TD VALIGN="TOP"><TT>Alias</TT>
<TD>Substitutes one pathname for another, such as <TT>Alias data /usr/www/data</TT>.
<TR>
<TD VALIGN="TOP"><TT>DefaultType</TT>
<TD>The default <TT>MIME</TT> type, usually <TT>text/plain</TT>.
<TR>
<TD VALIGN="TOP"><TT>DefaultIcon</TT>
<TD>The default icon to use when <TT>FancyIndexing</TT> is on (default is <TT>/icons/unknown.xbm</TT>).
<TR>
<TD VALIGN="TOP"><TT>DirectoryIndex</TT>
<TD>Filename to return when the URL is for your service only. Default value is <TT>index.html</TT>.
<TR>
<TD VALIGN="TOP"><TT>DocumentRoot</TT>
<TD>Absolute path to the HTML document directory. Default is <TT>/usr/local/etc/httpd/htdocs</TT>.
<TR>
<TD VALIGN="TOP"><TT>FancyIndexing</TT>
<TD>Adds icons and filename information to the file list for indexing. Default is on. (This option is for backward compatibility with the first release of HTTP.)
<TR>
<TD VALIGN="TOP"><TT>HeaderName</TT>
<TD>The filename used at the top of a list of files being indexed. Default is <TT>Header</TT>.
<TR>
<TD VALIGN="TOP"><TT>IndexOptions</TT>
<TD>Indexing parameters (including <TT>FancyIndexing</TT>, <TT>IconsAreLinks</TT>, <TT>ScanHTMLTitles</TT>, <TT>SuppressLastModified</TT>, <TT>SuppressSize</TT>, and <TT>SuppressDescription</TT>).
<TR>
<TD VALIGN="TOP"><TT>ReadmeName</TT>
<TD>The footer file is displayed with directory indexes. Default is <TT>README</TT>.
<TR>
<TD><TT>Redirect</TT>
<TD>Maps a path to another URL.
<TR>
<TD><TT>ScriptAlias</TT>
<TD>Similar to <TT>Alias</TT> but for scripts.
<TR>
<TD VALIGN="TOP"><TT>UserDir</TT>
<TD>Directory users can use for <TT>httpd</TT> access. Default is <TT>public_html</TT>. Usually set to a user’s home page directory. Can be set to <TT>DISABLED</TT>.
</TABLE>
</CENTER>
<P>The third file to examine and modify is <TT>access.conf-dist</TT>, which defines the services available to WWW browsers. Usually, everything is accessible to a browser, but you may want to modify the file to tighten security or disable some services not supported on your Web site. The format of the <TT>conf-dist</TT> file is different than the two preceding configuration files. It uses a set of “sectioning directives” delineated by angle brackets. The general format of an entry is:</P>
<!-- CODE SNIP //-->
<PRE>
<I><Directory Dir_Name></I>
…
</Directory>
</PRE>
<!-- END CODE SNIP //-->
<P>and anything between the beginning and ending delimiters (<TT><Directory></TT> and <TT></Directory></TT>, respectively) are directives. Actually, it’s not quite that easy because there are several variations that can exist in the file. The best way to customize the <TT>access.conf-dist</TT> file is to follow these steps for a typical Web server installation:</P>
<DL>
<DD><B>1.</B> Locate the Options directive and remove the Indexes option. This prevents users from browsing the <TT>httpd</TT> directory. Valid Options entries are discussed shortly.
<DD><B>2.</B> Locate the first Directory directive and check the path to the <TT>cgi-bin</TT> directory. The default path is <TT>/usr/local/etc/httpd/cgi-bin</TT>.
<DD><B>3.</B> Find the <TT>AllowOverride</TT> variable and set it to <TT>None</TT> (this prevents others from changing the settings). The default is <TT>All</TT>. Valid values for the <TT>AllowOverride</TT> variable are discussed shortly.
<DD><B>4.</B> Find the Limit directive and set to whichever value you want.
</DL>
<P>The Limit directive controls access to your server. The following are valid values for the Limit directive:
</P>
<CENTER>
<TABLE WIDTH="80%"><TR>
<TD WIDTH="40%" VALIGN="TOP"><TT>allow</TT>
<TD WIDTH="60%">Allows specific host names following the <TT>allow</TT> keyword to access the service.
<TR>
<TD VALIGN="TOP"><TT>deny</TT>
<TD>Denies specific host names following the <TT>deny</TT> keyword from accessing the service.
<TR>
<TD VALIGN="TOP"><TT>order</TT>
<TD>Specifies the order in which <TT>allow</TT> and <TT>deny</TT> directives are evaluated (usually set to <TT>deny,allow</TT> but can also be <TT>allow,deny</TT>).
<TR>
<TD VALIGN="TOP"><TT>require</TT>
<TD>Requires authentication through a user file specified in the <TT>AuthUserFile</TT> entry.
</TABLE>
</CENTER>
<P>The Options directive can have several entries, all of which have a different purpose. The default entry for Options is
</P>
<!-- CODE SNIP //-->
<PRE>
Options Indexes FollowSymLinks
</PRE>
<!-- END CODE SNIP //-->
<P>You removed the Indexes entry from the Options directive in the first step of the preceding customization procedure. These entries all apply to the directory the <TT>Options</TT> field appears in. The valid entries for the Options directive are:</P>
<CENTER>
<TABLE WIDTH="80%"><TR>
<TD WIDTH="40%"><TT>All</TT>
<TD WIDTH="60%">All features enabled.
<TR>
<TD VALIGN="TOP"><TT>ExecCGI</TT>
<TD><TT>cgi</TT> scripts can be executed from this directory.
<TR>
<TD><TT>FollowSymLinks</TT>
<TD>Allows <TT>httpd</TT> to follow symbolic links.
<TR>
<TD><TT>Includes</TT>
<TD><TT>Include</TT> files for the server are enabled.
<TR>
<TD VALIGN="TOP"><TT>IncludesNoExec</TT>
<TD><TT>Include</TT> files for the server are enabled but the <TT>exec</TT> option is disabled.
<TR>
<TD VALIGN="TOP"><TT>Indexes</TT>
<TD>Enables users to retrieve server-generated indexes (doesn’t affect precompiled indexes).
<TR>
<TD><TT>None</TT>
<TD>No features enabled.
<TR>
<TD VALIGN="TOP"><TT>SymLinksIfOwnerMatch</TT>
<TD>Follows symbolic links only if the user ID of the symbolic link matches the user ID of the file.
</TABLE>
</CENTER>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="836-838.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="841-843.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?