98N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
98N/A<
TITLE>Starting Apache</
TITLE>
98N/A<!-- Background white, links blue (unvisited), navy (visited), red (active) --> 98N/A<
H1 ALIGN="CENTER">Starting Apache</
H1>
98N/A<
H2>Invoking Apache</
H2>
98N/AOn Unix, the <
CODE>httpd</
CODE> program is usually run as a daemon
98N/Awhich executes continuously, handling requests. It is possible to
98N/Ainvoke Apache by the Internet daemon <
CODE>inetd</
CODE> each time a
98N/Aconnection to the HTTP service is made (use the <
A 98N/AOn Windows, Apache is normally run as a service on Windows NT, or as a
98N/Aconsole application on Windows 95. See also <
A 98N/A<
H2>Command line options</
H2>
98N/AThe following options are recognized on the httpd command line:
98N/A<
DT><
CODE>-d</
CODE> <
EM>serverroot</
EM>
98N/A<
DD>Set the initial value for the
98N/A<
EM>serverroot</
EM>. This can be overridden by the ServerRoot command
98N/Ain the configuration file. The default is
98N/AWindows and <
CODE>/os2httpd</
CODE> on OS/2.
98N/A<
DT><
CODE>-D</
CODE> <
EM>name</
EM>
98N/A<
DD>Define a name for use in in
98N/AThis option can be used to optionally enable certain functionality in the
98N/Aconfiguration file, or to use a common configuration for
98N/Aseveral independent hosts, where host specific information is enclosed in
98N/A<IfDefine> sections.
98N/A<
DT><
CODE>-f</
CODE> <
EM>config</
EM>
98N/A<
DD>Execute the commands in the file <
EM>config</
EM> on startup. If
98N/A<
EM>config</
EM> does not begin with a <
CODE>/</
CODE>, then it is taken to be a
98N/A<
DT><
CODE>-C</
CODE> <
EM>"directive"</
EM>
98N/A<
DD>Process the given apache "directive" (just as if it had been part of a
98N/Aconfiguration file) <
STRONG>before</
STRONG> actually reading the regular configuration files.
98N/A<
DT><
CODE>-c</
CODE> <
EM>"directive"</
EM>
98N/A<
DD>Process the given apache "directive" <
STRONG>after</
STRONG> reading
98N/Aall the regular configuration files.
98N/A<
DD>Run in single-process mode, for internal debugging purposes only; the
98N/Adaemon does not detach from the terminal or fork any children. Do <
EM>NOT</
EM>
98N/Ause this mode to provide ordinary web service.
98N/A<
DD>Print the version of httpd and its build date, and then exit.
98N/A<
DT><
A NAME="version"><
CODE>-V</
CODE></
A>
98N/A<
DD>Print the base version of httpd, its
98N/Abuild date, and a list of compile time settings which influence the
98N/Abehavior and performance of the apache server (<
EM>
e.g.</
EM>,
98N/A<
SAMP>-DUSE_MMAP_FILES</
SAMP>),
98N/A<
DT><
A NAME="help"><
CODE>-L</
CODE></
A>
98N/A<
DD>Give a list of directives together with expected arguments and
98N/Aplaces where the directive is valid. (New in Apache 1.2)
<
DD>Give a list of all modules compiled into the server.
<
DD>Show the settings as parsed from the config file (currently only
shows a breakdown of the vhost settings).
<
DD>Test the configuration file syntax (<
EM>
i.e.</
EM>, read all configuration files
and interpret them) but do not start the server. If the configuration contains
errors, display an error message and exit with a non-zero exit status,
otherwise display "Syntax OK" and terminate with a zero exit status.
<
DT><
CODE>-k</
CODE> <
EM>option</
EM>
<
DD>Windows only: signal Apache to restart or shutdown. <
EM>option</
EM>
is one of "shutdown" or "restart". (New in Apache 1.3.3).
<
DD>Print a list of the httpd options, and then exit.
<
H2>Configuration files</
H2>
The server will read three files for configuration directives. Any
directive may appear in any of these files. The the names of these
files are taken to be relative to the server root; this is set by the
<
A HREF="mod/core.html#serverroot">ServerRoot</
A> directive, the
<
CODE>-d</
CODE> command line flag, or (on Windows only) the registry
(see <
A HREF="windows.html#run">Running Apache for Windows</
A>).
Conventionally, the files are:
<
DD>Contains directives that control the operation of the server daemon.
The filename may be overridden with the <
CODE>-f</
CODE> command line flag.
<
DD>Contains directives that control the specification of documents that
the server can provide to clients. The filename may be overridden with
the <
A HREF="mod/core.html#resourceconfig">ResourceConfig</
A> directive.
<
DD>Contains directives that control access to documents.
The filename may be overridden with the
<
A HREF="mod/core.html#accessconfig">AccessConfig</
A> directive.
However, these conventions need not be adhered to.
The server also reads a file containing mime document types; the filename
<
H3>security warning</
H3>
Anyone who can write to the directory where Apache is writing a
log file can almost certainly gain access to the uid that the server is
started as, which is normally root. Do <
EM>NOT</
EM> give people write
access to the directory the logs are stored in without being aware of
On startup, Apache saves the process id of the parent httpd process to
the file <
CODE>
logs/
httpd.pid</
CODE>. This filename can be changed
with the <
A HREF="mod/core.html#pidfile">PidFile</
A> directive. The
process-id is for use by the administrator in restarting and
terminating the daemon: on Unix, a HUP or USR1 signal causes the
daemon to re-read its configuration files and a TERM signal causes it
to die gracefully; on Windows, use the -k command line option instead.
For more information see the <
A HREF="stopping.html">Stopping and
If the process dies (or is killed) abnormally, then it will be necessary to
kill the children httpd processes.
The server will log error messages to a log file, by default
OS/2. The filename can be set using the <
AHREF="mod/core.html#errorlog">ErrorLog</
A> directive; different error
logs can be set for different <
AThe server will typically log each request to a transfer file, by
directive or additional log files created with the <
Adifferent transfer logs can be set for different <
A