836-838.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 180 行
HTML
180 行
<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=836-838//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="833-836.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="838-841.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading4"></A><FONT COLOR="#000077">Compiling the Web Software</FONT></H4>
<P>If you don’t have to modify the source and recompile for Linux (because your software is the Linux version), you can skip the configuration details mentioned in the rest of this section. On the other hand, you may want to know what is happening in the source code anyway because you can better understand how Linux works with the Web server code. If you obtained a generic, untailored version of the NCSA Web server, you have to configure the software.
</P>
<P>Begin by editing the <TT>src/Makefile</TT> file to specify your platform. There are several variables that you have to check for proper information:</P>
<CENTER>
<TABLE WIDTH="80%"><TR>
<TD WIDTH="40%" VALIGN="TOP"><TT>AUX_CFLAGS</TT>
<TD WIDTH="60%">Uncomment the entry for Linux (identified by comment lines and symbols, usually).
<TR>
<TD VALIGN="TOP"><TT>CC</TT>
<TD>The name of the C compiler (usually <TT>cc</TT> or <TT>gcc</TT>).
<TR>
<TD VALIGN="TOP"><TT>EXTRA_LIBS</TT>
<TD>Add any extra libraries that need to be linked in (none are required for Linux).
<TR>
<TD VALIGN="TOP"><TT>FLAGS</TT>
<TD>Add any flags you need for linking (none are required for most Linux linkers).
</TABLE>
</CENTER>
<P>Finally, look for the <TT>CFLAGS</TT> variable. Some of the values for <TT>CFLAGS</TT> may be set already. The following are valid values for <TT>CFLAGS</TT>:</P>
<CENTER>
<TABLE WIDTH="80%"><TR>
<TD WIDTH="40%" VALIGN="TOP"><TT>-DSECURE_LOGS</TT>
<TD WIDTH="60%">Prevents CGI scripts from interfering with any log files written by the server software.
<TR>
<TD VALIGN="TOP"><TT>-DMAXIMUM_DNS</TT>
<TD>Provides a more secure resolution system at the cost of performance.
<TR>
<TD VALIGN="TOP"><TT>-DMINIMAL_DNS</TT>
<TD>Doesn’t allow reverse name resolution, but speeds up performance.
<TR>
<TD VALIGN="TOP"><TT>-DNO_PASS</TT>
<TD>Prevents multiple children from being spawned.
<TR>
<TD VALIGN="TOP"><TT>-DPEM_AUTH</TT>
<TD>Enables PEM/PGP authentication schemes.
<TR>
<TD VALIGN="TOP"><TT>-DXBITHACK</TT>
<TD>Provides a service check on the execute bit of an HTML file.
<TR>
<TD><TT>-O2</TT>
<TD>Optimizing flag.
</TABLE>
</CENTER>
<P>It is unlikely that you will need to change any of the flags in the <TT>CFLAGS</TT> section, but at least you now know what they do. Once you have checked the <TT>src/Makefile</TT> for its contents, you can compile the server software. Issue the command:</P>
<!-- CODE SNIP //-->
<PRE>
make linux
</PRE>
<!-- END CODE SNIP //-->
<P>If you see error messages, check the configuration file carefully. The most common problem is the wrong platform (or multiple platforms) selected in the file.
</P>
<H4 ALIGN="LEFT"><A NAME="Heading5"></A><FONT COLOR="#000077">Configuring the Web Software</FONT></H4>
<P>Once the software is in the proper directories and compiled for your platform, it’s time to configure the system. Begin with the <TT>httpd.conf-dist</TT> file. Copy it to the filename <TT>httpd.conf</TT>, which is what the server software looks for. This file handles the <TT>httpd</TT> server daemon. Before you edit the file, you have to decide whether you will install the Web server software to run as a daemon or whether it will be started by <TT>inetd</TT>. If you anticipate frequent use, run the software as a daemon. For occasional use, either is acceptable.</P>
<P>There are several variables in <TT>httpd.conf</TT> that need to be checked or have values entered for them. All the variables in the configuration file follow the syntax:</P>
<!-- CODE SNIP //-->
<PRE>
<I>variable value</I>
</PRE>
<!-- END CODE SNIP //-->
<P>with no equal sign or special symbol between the variable name and the value assigned to it. For example, a few lines would look like this:
</P>
<!-- CODE SNIP //-->
<PRE>
FancyIndexing on
HeaderName Header
ReadmeName README
</PRE>
<!-- END CODE SNIP //-->
<P>Where pathnames or filenames are supplied, they are usually relative to the Web server directory, unless explicitly declared as a full pathname. You need to supply the following variables in <TT>httpd.conf</TT>:</P>
<CENTER>
<TABLE WIDTH="80%"><TR>
<TD WIDTH="40%" VALIGN="TOP"><TT>AccessConfig</TT>
<TD WIDTH="60%">The location of the <TT>access.conf</TT> configuration file. The default value is <TT>conf/access.conf</TT>. You can use either absolute or relative pathnames.
<TR>
<TD VALIGN="TOP"><TT>AgentLog</TT>
<TD>The log file to record details of the type and version of browser used to access your server. The default value is <TT>logs/agent_log</TT>.
<TR>
<TD VALIGN="TOP"><TT>ErrorLog</TT>
<TD>The name of the file to record errors. The default is <TT>/logs/error_log</TT>.
<TR>
<TD VALIGN="TOP"><TT>Group</TT>
<TD>The Group ID the server should run as (used only when server is running as a daemon). Can be either a group name or group ID number. If a number, it must be preceded by <TT>#</TT>. The default is <TT>#-1</TT>.
<TR>
<TD VALIGN="TOP"><TT>MaxServers</TT>
<TD>The maximum number of children allowed.
<TR>
<TD VALIGN="TOP"><TT>PidFile</TT>
<TD>The file where you want to record the process ID of each <TT>httpd</TT> copy. The default is <TT>/logs/httpd.pid</TT>. Used only when the server is in daemon mode.
<TR>
<TD VALIGN="TOP"><TT>Port</TT>
<TD>Port number <TT>httpd</TT> should listen to for clients. Default port is 80. If you don’t want the Web server generally available, choose another number.
<TR>
<TD VALIGN="TOP"><TT>ResourceConfig</TT>
<TD>The path to the <TT>srm.conf</TT> file, usually <TT>conf/srm.conf</TT>.
<TR>
<TD><TT>ServerAdmin</TT>
<TD>Email address of the administrator.
<TR>
<TD><TT>ServerName</TT>
<TD>The fully qualified host name of the server.
<TR>
<TD VALIGN="TOP"><TT>ServerRoot</TT>
<TD>The path above which users cannot move (usually the Web server top directory or <TT>usr/local/etc/httpd</TT>).
<TR>
<TD><TT>ServerType</TT>
<TD>Either standalone (daemon) or <TT>inetd.</TT>
<TR>
<TD VALIGN="TOP"><TT>StartServers</TT>
<TD>The number of server processes that are started when the daemon executes.
<TR>
<TD VALIGN="TOP"><TT>TimeOut</TT>
<TD>The amount of time in seconds to wait for a client request, after which it is disconnected (default is 1,800, which should be reduced).
<TR>
<TD VALIGN="TOP"><TT>TransferLog</TT>
<TD>The path to the location of the access log. Default is <TT>logs/access_log</TT>.
<TR>
<TD VALIGN="TOP"><TT>TypesConfig</TT>
<TD>The path to the location of the <TT>MIME</TT> configuration file. Default is <TT>conf/mime.conf</TT>.
<TR>
<TD VALIGN="TOP"><TT>User</TT>
<TD>Defines the user ID the server should run as (only valid if running as a daemon). Can be name or number but must be preceded by <TT>#</TT> if a number. Default is <TT>#-1</TT>.
</TABLE>
</CENTER>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="833-836.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="838-841.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?