📄 673-675.html
字号:
<HTML>
<HEAD>
<TITLE>Special Edition Using Linux, Fourth Edition:Getting Started with 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=35//-->
<!--PAGES=673-675//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="../ch34/666-668.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="675-677.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H3><A NAME="Heading6"></A><FONT COLOR="#000077">Establishing the File Hierarchy</FONT></H3>
<P>The next step in the process of setting up a server is to make some fundamental decisions regarding where on the file system different parts of the server will reside. Write down your decisions for each of these; you will need them in the next section, “Performing a Basic Configuration.”
</P>
<P>The first thing you need to decide is where the <I>server root</I> will be. This is the subdirectory in which the server will reside and from which the conf/ directory, the logs/ and cgi-bin/ subdirectories, and other server-related directories lead. The default suggestion is to have this as /usr/local/apache although the usual server root is /pub/htdocs. You can have your configuration files and logfiles in other locations. The server root was designed to be a convenient place to keep everything server-related together. Also, if the server crashes and leaves a core file, it will be found in the server root directory.</P>
<P>The second decision is where the <I>document root</I>, the directory in which all your HTML and other media reside, will be located. A file called myfile.html in the document root would be referenced as <A HREF="http://host.com/index.html">http://host.com/index.html</A>. This directory can be a subdirectory of the server root, or it can be outside the server root and in its own directory. It’s commonly located as a subdirectory of the server root and named htdocs. If, for more disk space or other reasons, you choose to move the document root out of the server root directory, you should give it a pretty short name—for example, /home/www or /www/htdocs. If you’re implementing a Web server on top of an FTP server, for example, you might want to point the document root at /home/ftp/pub.</P>
<P>Finally, you need to decide where on your server you’ll keep your logfiles. This space should have a fairly large working area, depending on how busy you estimate your server will be. For a point of reference, a site with 100K hits per day (which would fall under moderate traffic, relatively speaking) can expect to generate 15MB per day of logfile information. For performance reasons, it’s usually best to have the log directory on a separate disk partition or even a separate disk drive altogether, because on even a moderately busy server the access log can be written to several times per second.</P>
<H3><A NAME="Heading7"></A><FONT COLOR="#000077">Performing a Basic Configuration</FONT></H3>
<P>This section covers the minimal set of changes you need to make to the configuration files in order to launch a basic Web site.
</P>
<P>Apache has three separate configuration files. This model goes back to NCSA, and the reasoning is sound: There are largely three main areas of administrative configuration, so setting them up as separate files allows Webmasters to give different write permissions to each if they so desire.</P>
<P>You’ll find the configuration files for Apache in the conf/ subdirectory of the server root directory. Each has been provided with a <TT>-dist</TT> file-name suffix; it’s recommended that you make a copy without the <TT>-dist</TT> and edit those new files, keeping the <TT>-dist</TT> versions as backups and reference.</P>
<P>The basic format of the configuration files is a combination of a shell-like interface and pseudo-HTML. The elemental unit is the directive, which can take a number of arguments—essentially,</P>
<!-- CODE SNIP //-->
<PRE>
<I>Directive argument argument ....</I>
</PRE>
<!-- END CODE SNIP //-->
<P>that is,
</P>
<!-- CODE SNIP //-->
<PRE>
Port 80
</PRE>
<!-- END CODE SNIP //-->
<P>or
</P>
<!-- CODE SNIP //-->
<PRE>
AddIcon /icons/back.gif ..
</PRE>
<!-- END CODE SNIP //-->
<P>You can also group directives together inside certain pseudo-HTML tags. Unlike HTML, these tags should be on their own line as in the following example:
</P>
<!-- CODE SNIP //-->
<PRE>
<Virtualhost www.myhost.com>
DocumentRoot /www/htdocs/myhost.com
ServerName www.myhost.com
</Virtualhost>
</PRE>
<!-- END CODE SNIP //-->
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE: </B>The Virtualhost directive allows a single server to pretend to be multiple servers. For example, the host specified above, <A HREF="www.myhost.com">www.myhost.com</A>, doesn’t have to be on a computer named <A HREF="www.myhost.com">www.myhost.com</A>; it could reside on a computer named hosts.netwharf.com.<HR></FONT>
</BLOCKQUOTE>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="../ch34/666-668.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="675-677.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 + -