📄 asg02.htm
字号:
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE>If you are running the server in a nonstandard port, such as 8080, you'll need to specify the port number as part of the URL:
<BR>httpd://yourhost.yourdomain.com:<I>port</I></NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<P><A NAME="I22"></A>If there was a problem with the server or a configuration, Apache is pretty good about giving you an indication about the problem. If Apache could not find some of the configuration files, it should give you a message like this:
<BR>
<PRE>
<FONT COLOR="#000080">httpd: could not open document config file /usr/local/etc/httpd/conf/httpd.conf
fopen: No such file or directory</FONT></PRE>
<P>Check for typos or incorrect path information on your command line or in the configuration files. Typically this problem appears if you have customized your installation to a different directory. Apache has compiled-in defaults that preset the location of ServerRoot. If you specify a relative path, the server prefixes the compiled-in ServerRoot instead.
<BR>
<P>Other problems may have dump values such as
<BR>
<PRE>
<FONT COLOR="#000080">httpd: could not bind to port
bind: Address already in use</FONT></PRE>
<P>If you get this message, more than likely there's another process using the port number you have defined. Other port binding problems can show up if you specify a reserved port number (one whose address is smaller than 1025). Only root processes can bind to reserved ports. The solution is to start the server as root so that the server can bind properly to the specified port (if you have followed our instructions, your server although started by root, runs as nobody).
<BR>
<P>If the server doesn't respond, check to see if it is running. Use the ps program to see what's going on:
<BR>
<UL>
<UL>
<P>ps -guax | grep httpd (on BSD-type systems)
<BR>
</UL></UL>
<UL>
<UL>
<P>ps -ef | grep httpd (on SVR4-type systems)
<BR>
</UL></UL>
<P>Don't get worried if you see several httpd processes running. Apache's server model runs several simultaneous processes coordinated by the parent process (the one owned by root).
<BR>
<P>Sometimes Apache returns enough information that will help you track a problem to a bad configuration setting. Other times, you'll have to hunt for the error. The first thing to check are the logs/error_log and logs/access_log files for more information. While you're at it, you may want to check for any core files in the ServerRoot. If some problem is crashing Apache (I've never had one that dumped core), it's likely that it left a trace there.
<BR>
<BR>
<A NAME="E68E22"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Configuration File Listings</B></FONT></CENTER></H3>
<BR>
<P>For your convenience, here's a listing of the various configuration files I talked about in this chapter.
<BR>
<BR>
<A NAME="E69E14"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>src/Configuration</B><B> File</B></FONT></CENTER></H4>
<BR>
<P>After you configure and build your server, you won't have to edit this file. At least not until you enable additional modules. You will then have to add them here, and repeat the configuration and binary building process again.
<BR>
<P>
<FONT COLOR="#000080"><A NAME="I23"></A><B>Listing 2.2. The </B><B>Configuration.tmpl</B><B> File</B></FONT>
<BR>
<PRE>
<FONT COLOR="#000080"># Config file for the Apache httpd.
# Configuration.tmpl is the template for Configuration. Configuration should
# be edited to select system type. Configuration.tmpl should only be changed
# when a new system or module is added, or an existing one modified.
# There are three types of lines here:
# '#' comments, distinguished by having a '#' as the first non-blank character
#
# Lines which set a Make option --- these are simply copied into the Makefile
#
# Module selection lines, distinguished by having 'Module' at the front.
# These list the configured modules, in priority order (highest priority
# first). They're down at the bottom.
# First, ordinary compile-time configuration.
# What to call the compiler: For normal machines with ANSI compilers
# CC= cc
# For Suns or other non-ANSI platforms. Please make sure your gcc is
# 2.0 or later, as 1.40 seems to create bad code for the Sun 4.
CC= gcc
# CFLAGS, compile flags.
# -DMINIMAL_DNS is now obsolete. Use httpd.conf settings of
# HostnameLookups on
# or
# HostnameLookups off
#
# If you want to have more secure hostname resolution at the cost of some
# performance, use -DMAXIMUM_DNS.
# If you want setting the xbit of a file to cause it to be treated as
# server-included HTML (unless it is a CGI script), say -DXBITHACK. Note
# that this is a run-time option, per-directory, either way (via the XBITHACK
# command); this option only sets the default.
# If you find that your OS can't cope with mmap (compiles OKAY but refuses
# to run and moans "httpd: Could not mmap memory" .. or similar) try
# disabling use of shared memory for process management (scoreboard with
# -DNO_MMAP
# Status Instrumentation
# In order for the status module to obtain full statistics Apache must
# be modified to keep track of various information. This is not
# turned on by default. In order to enable full status details add -DSTATUS
# to the end of the CFLAGS line below.
# Using SOCKS
# Apache can be compiled to work over a SOCKS firewall by
# adding the following string to your CFLAGS define:
#
# -Dconnect=Rconnect -Dselect=Rselect -Dgethostbyname=Rgethostbyname
#
# and by adding the following to the EXTRA_LIBS define:
#
# -L/usr/local/lib -lsocks
#
# making sure that -L points to wherever you've put libsocks.a.
# [Some other former Apache compile-time options are now treated differently;
# the virtual host code is always present; DBM auth is an optional module, and
# may be configured out by changing the module config below, though it still
# defaults in. Note that this config file does not include DBM auth by
# default --- configure it in below if you need it].
CFLAGS= -O2
# Place here any flags you may need upon linking, such as a flag to
# prevent dynamic linking (if desired)
LFLAGS=
# Place here any extra libraries you may need to link to.
# -lndbm is commonly required for DBM auth, if that is configured in.
EXTRA_LIBS=
# AUX_CFLAGS are system-specific control flags.
# NOTE: IF YOU DO NOT CHOOSE ONE OF THESE, EDIT httpd.h AND CHOOSE
# SETTINGS FOR THE SYSTEM FLAGS. IF YOU DON'T, BAD THINGS WILL HAPPEN.
# For SunOS 4
#AUX_CFLAGS= -DSUNOS4
# For Solaris 2.
#AUX_CFLAGS= -DSOLARIS2
#AUX_LIBS= -lsocket -lnsl
# For SGI IRIX. Use the AUX_LIBS line if you're using NIS and want
# user-supported directories
#AUX_CFLAGS= -DIRIX
#AUX_LIBS= -lsun
# For HP-UX n.b. if you use the paid-for HP CC compiler, use flag -Ae
#AUX_CFLAGS= -DHPUX
# For AIX
#AUX_CFLAGS= -DAIX -U__STR__
# For Ultrix
#AUX_CFLAGS= -DULTRIX
# For DEC OSF/1
#AUX_CFLAGS= -DOSF1
# For NeXT
#AUX_CFLAGS= -DNEXT
# For Sequent
#AUX_CFLAGS= -DSEQUENT
# For Linux -m486 ONLY IF YOU HAVE 486 BINARY SUPPORT IN KERNEL
#AUX_CFLAGS= -DLINUX
# For A/UX
#AUX_CFLAGS= -DAUX -D_POSIX_SOURCE
#AUX_LIBS= -lposix -lbsd -s
# For SCO ODT 3
# libcrypt_i available from sosco.sco.com, files /SLS/lng225b.Z and
# /SLS/lng225b.ltr.Z
# the -Oe option causes cc to die compiling mod_imap (using 3.0.0a of the dev sys)
#CFLAGS= -Oacgiltz
#AUX_CFLAGS= -DSCO
#AUX_LIBS= -lPW -lsocket -lmalloc -lcrypt_i
# For SCO OpenServer Release 5
# -K noinline is needed to work around an optimiser bug which appears in
# http_bprintf.c
#AUX_CFLAGS= -DSCO5
#AUX_LIBS=-lsocket -lmalloc -lprot
#BROKEN_BPRINTF_FLAGS=-K noinline
# For SVR4
# Some SVR4 implementations will require SO_LINGER option to be set in order
# to guarantee buffer flushes. Dell, Esix, and UnixWare are a few of these.
# Use -DNEED_LINGER in addition to other AUX_CFLAGS for these.
#AUX_CFLAGS= -DSVR4
#AUX_LIBS= -lsocket -lnsl -lc
# For UnixWare 2.x, no longer just SVR4 (sigh) - use cc, not gcc
# AUX_LIBS= -lsocket -lnsl -lcrypt
# For Amdahl UTS 2.1
# -Xa enables ANSI mode, -eft is expanded types
#AUX_CFLAGS= -Xa -eft -DUTS21
#AUX_LIBS= -lsocket -lbsd -la
# For HP/Apollo Domain/OS
#AUX_CFLAGS= -DAPOLLO
# For NetBSD/FreeBSD/BSDI 2.x
# -m486 only if you are running on Intel 486/586
#AUX_CFLAGS= -m486
# BSDI doesn't need -lcrypt
#AUX_LIBS= -lcrypt
# For QNX
#AUX_CFLAGS= -DQNX
#AUX_LFLAGS= -N 0x20000
# For LynxOS
#AUX_CFLAGS= -DLYNXOS
#EXTRA_LIBS=-lbsd -ldes -lc_p
# For DG/UX 5.4
#AUX_CFLAGS= -DDGUX
#AUX_LIBS=
# For EMX OS/2 port
#AUX_CFLAGS= -Zbsd-signals -Zbin-files
#-DNO_KILLPG -DNEED_STRCASECMP -DNO_SETSID
#-g
#AUX_LIBS= -lsocket -llibufc -lgdbm -lbsd
################################################################
# Module configuration
#
# Modules are listed in reverse priority order --- the ones that come
# later can override the behavior of those that come earlier. This
# can have visible effects; for instance, if UserDir followed Alias,
# you couldn't alias out a particular user's home directory.
# The configuration below is what we consider a decent default
# configuration. If you want the functionality provided by a particular
# module, remove the "#" sign at the beginning of the line. But remember,
# the more modules you compile into the server, the larger the executable
# is and the more memory it will take, so if you are unlikely to use the
# functionality of a particular module you might wish to leave it out.
## Basic modules (i.e., generally useful stuff that works everyplace):
## You should probably not comment out any of these unless you know what it
## does and you know you won't need it.
Module mime_module mod_mime.o
Module access_module mod_access.o
Module auth_module mod_auth.o
Module negotiation_module mod_negotiation.o
Module includes_module mod_include.o
Module dir_module mod_dir.o
Module cgi_module mod_cgi.o
Module userdir_module mod_userdir.o
Module alias_module mod_alias.o
Module env_module mod_env.o
Module common_log_module mod_log_common.o
## The asis module implemented ".asis" file types, which allow the embedding
## of HTTP headers at the beginning of the document. mod_imap handles internal
## imagemaps (no more cgi-bin/imagemap/!). mod_actions is used to specify
## CGI scripts which act as "handlers" for particular files, for example to
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -