📄 ch51.htm
字号:
may be set already. The following are valid values for <TT>CFLAGS</TT>:
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-DSECURE_LOGS</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Prevents CGI scripts from interfering with any log files written by the server software.
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-DMAXIMUM_DNS</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Provides a more secure resolution system at the cost of performance. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-DMINIMAL_DNS</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Doesn't allow reverse name resolution, but speeds up performance.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-DNO_PASS</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Prevents multiple children from being spawned. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-DPEM_AUTH</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Enables PEM/PGP authentication schemes. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-DXBITHACK</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Provides a service check on the execute bit of an HTML file. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-O2<BR>
</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Optimizing flag.<BR>
</TD>
</TR>
</TABLE>
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 this command:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">make linux
</FONT></PRE>
<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.
<CENTER>
<H4><A NAME="Heading7<FONT COLOR="#000077">Configuring the Web Software</FONT></H4>
</CENTER>
<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<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">variable value
</FONT></PRE>
<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:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">FancyIndexing on
HeaderName Header
ReadmeName README
</FONT></PRE>
<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>:
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>AccessConfig</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">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. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>AgentLog</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">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>. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>ErrorLog</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The name of the file to record errors. The default is <TT>/logs/error_log</TT>. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>Group</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The Group ID the server should run as (used only when server is running as a daemon).
Can be either a group name of group ID number. If a number, it must be preceded by
#. The default is <TT>#-1.</TT> </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>MaxServers</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The maximum number of children allowed. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>PidFile</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">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.
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>Port</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Port number <TT>httpd</TT> should listen to for clients. The default port is 80.
If you don't want the Web server generally available, choose another number. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>ResourceConfig</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The path to the <TT>srm.conf</TT> file, usually <TT>conf/srm.conf</TT>. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>ServerAdmin</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The e-mail address of the administrator. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>ServerName</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The fully qualified host name of the server. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>ServerRoot</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The path above which users cannot move (usually the Web server top directory or <TT>usr/local/etc/httpd</TT>).
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>ServerType</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Either standalone (daemon) or <TT>inetd.</TT> </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>StartServers</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The number of server processes that are started when the daemon executes. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>TimeOut</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The amount of time in seconds to wait for a client request, after which it is disconnected
(the default is 1800, which should be reduced). </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>TransferLog</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The path to the location of the access log. The default is <TT>logs/access_log</TT>.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>TypesConfig</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The path to the location of the <TT>MIME</TT> configuration file. The default is
<TT>conf/mime.conf</TT>. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>User<BR>
</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Defines the user ID the server should run as (only valid if running as daemon). Can
be name or number, but must be preceded by <TT># </TT>if a number. The default is
<TT>#-1</TT>.<BR>
</TD>
</TR>
</TABLE>
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 listed here:
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>AccessFileName</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The file that gives access permissions (default is <TT>.htaccess</TT>). </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>AddDescription</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Provides a description of a type of file. For example, an entry could be <TT>AddDescription</TT>
<TT>PostScript file</TT> <TT>*.ps</TT>. Multiple entries are allowed. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>AddEncoding</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Indicates that files with a particular extension are encoded somehow, such as <TT>AddEncoding
compress Z</TT>. Multiple entries are allowed. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>AddIcon</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Gives the name of the icon to display for each type of file. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>AddIconType</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Uses <TT>MIME</TT> type to determine the icon to use. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>AddType</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Overrides <TT>MIME</TT> definitions for extensions. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>Alias</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Substitutes one pathname for another, such as <TT>Alias data /usr/www/data</TT>.
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>DefaultType</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The default <TT>MIME</TT> type, usually <TT>text/plain</TT>. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD HEIGHT="37" ALIGN="LEFT" VALIGN="TOP"><TT>DefaultIcon</TT> </TD>
<TD HEIGHT="37" ALIGN="LEFT" VALIGN="TOP">The default icon to use when <TT>FancyIndexing</TT> is on (the default is <TT>/icons/unknown.xbm</TT>).
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>DirectoryIndex</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Filename to return when the URL is for your service only. The default value is <TT>index.html</TT>.
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>DocumentRoot</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Absolute path to the HTML document directory. The default is <TT>/usr/local/etc/httpd/htdocs.</TT>
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>FancyIndexing</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Adds icons and filename information to the file list for indexing. The default is
on. (This option is for backward compatibility with the first release of HTTP.) </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>HeaderName</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The filename used at the top of a list of files being indexed. The default is <TT>Header</TT>.
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>IndexOptions</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Indexing parameters (including <TT>FancyIndexing</TT>, <TT>IconsAreLinks</TT>, <TT>ScanHTMLTitles</TT>,
<TT>SuppressLastModified</TT>, <TT>SuppressSize</TT>, and <TT>SuppressDescription</TT>).
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>ReadmeName</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The footer file is displayed with directory indexes. The default is <TT>README</TT>.
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>Redirect</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Maps a path to another URL. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>ScriptAlias</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Similar to <TT>Alias</TT> but for scripts. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>UserDir<BR>
</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Directory users can use for <TT>httpd</TT> access. The default is <TT>public_html</TT>.
Usually set to a user's home page directory. Can be set to <TT>DISABLED</TT>.<BR>
</TD>
</TR>
</TABLE>
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<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF"><Directory Dir_Name>
...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -