📄 asg13.htm
字号:
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>status</I>
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
This field contains the three-digit HTTP status code returned to the client. Apache can return any of the following HTTP response codes:
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
200: OK
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
302: Found
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
304: Not Modified
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
400: Bad Request
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
401: Unauthorized
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
403: Forbidden
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
404: Not Found
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
500: Server Error
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
503: Out Of Resources (Service Unavailable)
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
501: Not Implemented
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
502: Bad Gateway
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The HTTP standard defines many other codes, so this list is likely to grow as new features are implemented in Apache.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>bytes</I>
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The size of the transfer in bytes returned to the client, not counting any header information.</FONT>
</TABLE>
<BR>
<A NAME="E69E153"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Enabling Logging</B></FONT></CENTER></H4>
<BR>
<P>To enable logging using the standard log format, use the TransferLog directive. This directive allows you to specify the filename to receive the logging information. Instead of a file, you can also specify a program to receive the information on its Standard Input stream (stdin).
<BR>
<P>The syntax of the TransferLog directive is as follows:
<BR>
<TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="80%" CELLPADDING=2 >
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Syntax:
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
TransferLog [<I>filename</I>] | [|<I>program</I>]
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Default:
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
TransferLog logs/transfer_log</FONT>
</TABLE><P><I>filename</I> is the name of a file relative of ServerRoot. If for some reason you don't want to log, specify /dev/null as the access log file.
<BR>
<P>|<I>program</I> is the pipe symbol (|) followed by a path to a program capable of receiving the log information on stdin.
<BR>
<P>As with any program started by the server, the program is run with the User ID (UID) and Group ID (GID) of the user that started the httpd daemon. If the user starting the program is root, be sure that the User directive demotes the server privileges to those of an unprivileged user such as nobody. Also, make sure the program is secure.
<BR>
<P>Here's a sample from an accesslog file generated by Apache for <A HREF="javascript:if(confirm('http://www.planetearthinc.com/ \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.planetearthinc.com/'" tppabs="http://www.planetearthinc.com/"> http://www.PlanetEarthInc.COM</A>, a site hosted at accessLINK:
<BR>
<PRE>
<FONT COLOR="#000080">sundmz1.bloomberg.com - - [20/Jul/1996:09:56:03 -0500] "GET /two.gif HTTP/1.0" 200 2563
sundmz1.bloomberg.com - - [20/Jul/1996:09:56:03 -0500] "GET /three.gif HTTP/1.0" 200 4078
sundmz1.bloomberg.com - - [20/Jul/1996:09:56:03 -0500] "GET /four.gif HTTP/1.0" 200 4090
pn3-ppp-109.primary.net - - [20/Jul/1996:09:57:29 -0500] "GET / HTTP/1.0" 200 5441
pn3-ppp-109.primary.net - - [20/Jul/1996:09:57:36 -0500] "GET /images/ultimate.gif HTTP/1.0" 200 7897
pn3-ppp-109.primary.net - - [20/Jul/1996:09:57:38 -0500] "GET /sponsors/banner-bin/emusic2.gif HTTP/1.0" 200 8977
pn3-ppp-109.primary.net - - [20/Jul/1996:09:57:44 -0500] "GET /images/hero.gif HTTP/1.0" 200 16098
128.58.101.231 - - [20/Jul/1996:09:59:19 -0500] "GET / HTTP/1.0" 200 5441
128.58.101.231 - - [20/Jul/1996:09:59:23 -0500] "GET / HTTP/1.0" 200 5441
slip-2-28.slip.shore.net - - [20/Jul/1996:10:03:44 -0500] "GET / HTTP/1.0" 200 5439
slip-2-28.slip.shore.net - - [20/Jul/1996:10:04:07 -0500] "GET /sponsors/banner-bin/books.gif HTTP/1.0" 200 5726
slip-2-28.slip.shore.net - - [20/Jul/1996:10:04:09 -0500] "GET /images/ultimate.gif HTTP/1.0" 200 7897
slip-2-28.slip.shore.net - - [20/Jul/1996:10:04:16 -0500] "GET /images/hero.gif HTTP/1.0" 200 16098
slip-12-16.ots.utexas.edu - - [20/Jul/1996:10:09:38 -0500] "GET / HTTP/1.0" 200 5441
slip-12-16.ots.utexas.edu - - [20/Jul/1996:10:09:50 -0500] "GET /anim.class HTTP/1.0" 200 12744
slip-12-16.ots.utexas.edu - - [20/Jul/1996:10:10:00 -0500] "GET /one.gif HTTP/1.0" 404 -
slip-12-16.ots.utexas.edu - - [20/Jul/1996:10:10:01 -0500] "GET /two.gif HTTP/1.0" 200 2563
slip-12-16.ots.utexas.edu - - [20/Jul/1996:10:10:05 -0500] "GET /three.gif HTTP/1.0" 200 4078
slip-12-16.ots.utexas.edu - - [20/Jul/1996:10:10:09 -0500] "GET /four.gif HTTP/1.0" 200 4090
slip-12-16.ots.utexas.edu - - [20/Jul/1996:10:10:12 -0500] "GET /five.gif HTTP/1.0" 200 3343
slip-12-16.ots.utexas.edu - - [20/Jul/1996:10:10:15 -0500] "GET /six.gif HTTP/1.0" 200 2122
slip-12-16.ots.utexas.edu - - [20/Jul/1996:10:10:18 -0500] "GET /seven.gif HTTP/1.0" 200 2244
slip-12-16.ots.utexas.edu - - [20/Jul/1996:10:11:06 -0500] "GET /eight.gif HTTP/1.0" 200 2334
www-j8.proxy.aol.com - - [20/Jul/1996:10:31:50 -0500] "GET / HTTP/1.0" 200 5443
www-j8.proxy.aol.com - - [20/Jul/1996:10:31:57 -0500] "GET /images/ultimate.gif HTTP/1.0" 200 7897
www-j8.proxy.aol.com - - [20/Jul/1996:10:31:57 -0500] "GET /images/hero.gif HTTP/1.0" 200 16098
www-j8.proxy.aol.com - - [20/Jul/1996:10:31:57 -0500] "GET /sponsors/banner-bin/ktravel.gif HTTP/1.0" 200 1500
sage.wt.com.au - - [20/Jul/1996:10:43:05 -0500] "GET / HTTP/1.0" 200 5441</FONT></PRE>
<P>By simple inspection of this log excerpt, you can see that most requests are answered successfully. Only one entry is suspicious:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">slip-12-16.ots.utexas.edu - - [20/Jul/1996:10:10:00 -0500] "GET /one.gif HTTP/1.0" 404 -</FONT></PRE>
<P>It has a response code 404 - "Not Found." The person maintaining this site should check to see if this error is repeated elsewhere because one of his pages could be referencing a broken link.
<BR>
<P>In addition to the standard mod_log_common logging module, Apache provides a log that is fully customizable. This log module is still considered experimental as of release 1.1, but according to some sources, it will be the preferred and default logging module for Apache 1.2. Even in its "experimental" state (actually it is just as reliable as the other one), its flexible log format may provide you with more useful logging capabilities and may give you the opportunity to reduce several logs into a single one.
<BR>
<BR>
<A NAME="E68E151"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Additional Logging Modules</B></FONT></CENTER></H3>
<BR>
<P>While the default logging agent, mod_log_common, will be more than adequate for most needs, other logging modules may be useful to you. As of version 1.1.1, Apache included the following modules which added logging capability:
<BR>
<UL>
<LI>mod_cookies
<BR>
<BR>
<LI>mod_log_agent (NCSA 1.4 Compatibility)
<BR>
<BR>
<LI>mod_log_referer(NCSA 1.4 Compatibility)
<BR>
<BR>
<LI>mod_log_config
<BR>
<BR>
</UL>
<P>Of these four modules, the most important ones are mod_log_config and mod_cookies. mod_log_config is a configurable module that provides much more flexibility when logging information. mod_cookies also provides a log, but more importantly it enables the automatic generation of cookies from within Apache (these cookies should not be confused with Netscape persistent cookies. For information on Netscape persistent cookies, refer to <A HREF="asg07.htm" tppabs="http://docs.rinet.ru:8080/Apachu/asg07.htm">Chapter 7</A>, "Third-Party Modules").
<BR>
<P>Cookies are an unique identifier that get handed down by the server when a browser makes an initial connection. Because this identifier is guaranteed to be unique, you can use it to follow a user navigating through your Web site.
<BR>
<P>The mod_log_agent and mod_log_referer are compatibility modules for users of the NCSA 1.4 Web server that are migrating to Apache. mod_log_agent logs the client (browser) that was used to access the resource. mod_log_referer logs the Web site the user is coming from. This last piece of information is useful to help you determine where users are coming from and where your site is referenced. The referer module is also useful for tracking stale links that refer to resources that have since moved or have been removed from your site. mod_log_config allows logging of the same information provided by mod_log_agent and mod_log_referer except that instead of logging into several different files, the information can be consolidated into one log. mod_log_config will help you reduce the complexity of log analysis scripts you develop, while at the same time produce logging information that is compatible with CLF.
<BR>
<P>Apache 1.2 will introduce new logging capabilities, including the ability to redirect errors from your CGI to a logfile—an enhanced user tracking cookie based log module—and the ability to have multiple configurable log files.
<BR>
<BR>
<A NAME="E68E152"></A>
<H3 ALIGN=CENTER>
<CENTER>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -