invoking.html revision 091caae3b2ebdb760c98575d0d5e349cd686f913
5a580c3a38ced62d4bcc95b8ac7c4f2935b5d294Timo Sirainen<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<HTML>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<HEAD>
9a583c7a827f7a4d89ee43774f2d51ea6a214543Timo Sirainen<TITLE>Starting Apache</TITLE>
16f816d3f3c32ae3351834253f52ddd0212bcbf3Timo Sirainen</HEAD>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen<BODY
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen BGCOLOR="#FFFFFF"
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen TEXT="#000000"
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen LINK="#0000FF"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen VLINK="#000080"
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen ALINK="#FF0000"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen>
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen<!--#include virtual="header.html" -->
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<H1 ALIGN="CENTER">Starting Apache</H1>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen<H2>Invoking Apache</H2>
289064eb21595d3e4460439eccdc48232d13f5e1Timo SirainenThe <CODE>httpd</CODE> program is usually run as a daemon which executes
dd0ba1bab2c1b89c7e063fa45d156fa72b8260d5Timo Sirainencontinuously, handling requests. It is possible to invoke Apache by
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainenthe Internet daemon <CODE>inetd</CODE> each time a connection to the HTTP
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainenservice is made (use the
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<A HREF="mod/core.html#servertype">ServerType</A> directive)
d33fc6c584718efd46159e1d8f46488b9dfc66f5Timo Sirainenbut this is not recommended.
d33fc6c584718efd46159e1d8f46488b9dfc66f5Timo Sirainen
d33fc6c584718efd46159e1d8f46488b9dfc66f5Timo Sirainen<H2>Command line options</H2>
d33fc6c584718efd46159e1d8f46488b9dfc66f5Timo SirainenThe following options are recognized on the httpd command line:
d33fc6c584718efd46159e1d8f46488b9dfc66f5Timo Sirainen<DL>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<DT><CODE>-d</CODE> <EM>serverroot</EM>
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<DD>Set the initial value for the
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<A HREF="mod/core.html#serverroot">ServerRoot</A> variable to
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<EM>serverroot</EM>. This can be overridden by the ServerRoot command in the
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenconfiguration file. The default is <CODE>/usr/local/apache</CODE>.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<DT><CODE>-f</CODE> <EM>config</EM>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<DD>Execute the commands in the file <EM>config</EM> on startup. If
a2ce2eb4c266e2854fd34416ea5cfbe05dfd3971Timo Sirainen<EM>config</EM> does not begin with a <CODE>/</CODE>, then it is taken to be a
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainenpath relative to the <A HREF="mod/core.html#serverroot">ServerRoot</A>. The
a2ce2eb4c266e2854fd34416ea5cfbe05dfd3971Timo Sirainendefault is <CODE>conf/httpd.conf</CODE>.
e9f2d9104d395bcf54be3f8ba8d9f63aecf0bcbeTimo Sirainen
d33fc6c584718efd46159e1d8f46488b9dfc66f5Timo Sirainen<DT><CODE>-X</CODE>
131b073bdc3650083b00616dc778dd3017c2bbb5Timo Sirainen<DD>Run in single-process mode, for internal debugging purposes only; the
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainendaemon does not detach from the terminal or fork any children. Do <EM>NOT</EM>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenuse this mode to provide ordinary web service.
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen<DT><CODE>-v</CODE>
df6478c4cf605bd81b3891c148b84c14eb6c4035Timo Sirainen<DD>Print the version of httpd and its build date, and then exit.
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<DT><A NAME="version"><CODE>-V</CODE></A>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<DD>Print the base version of httpd, its sub-version if defined, its
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainenbuild date, and a list of compile time settings which influence the
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainenbehavior and performance of the apache server (<EM>e.g.</EM>,
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<SAMP>-DUSE_MMAP_FILES</SAMP>),
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainenthen exit.
e1f05b193ac1edd3267294e9501e8063aa0f791aTimo Sirainen
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<DT><A NAME="help"><CODE>-h</CODE></A>
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<DD>Give a list of directives together with expected arguments and
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainenplaces where the directive is valid. (New in Apache 1.2)
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<DT><CODE>-l</CODE>
61b6d1256936065321153bcd9228b9e45d95c9abTimo Sirainen<DD>Give a list of all modules compiled into the server.
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<DT><CODE>-S</CODE>
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<DD>Show the settings as parsed from the config file (currently only
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainenshows a breakdown of the vhost settings).
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen
9f19a50d5966643c4d1c5ca06868ac2ad31bc4d5Timo Sirainen<DT><CODE>-?</CODE>
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<DD>Print a list of the httpd options, and then exit.
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen</DL>
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<H2>Configuration files</H2>
e34d170f8f0e084bd94bfbc1a7085ece67e508dfTimo SirainenThe server will read three files for configuration directives. Any directive
e34d170f8f0e084bd94bfbc1a7085ece67e508dfTimo Sirainenmay appear in any of these files. The the names of these files are taken
e34d170f8f0e084bd94bfbc1a7085ece67e508dfTimo Sirainento be relative to the server root; this is set by the
9f19a50d5966643c4d1c5ca06868ac2ad31bc4d5Timo Sirainen<A HREF="mod/core.html#serverroot">ServerRoot</A> directive, or the
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<CODE>-d</CODE> command line flag.
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo SirainenConventionally, the files are:
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<DL>
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<DT><CODE>conf/httpd.conf</CODE>
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<DD>Contains directives that control the operation of the server daemon.
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo SirainenThe filename may be overridden with the <CODE>-f</CODE> command line flag.
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<DT><CODE>conf/srm.conf</CODE>
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<DD>Contains directives that control the specification of documents that
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainenthe server can provide to clients. The filename may be overridden with
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainenthe <A HREF="mod/core.html#resourceconfig">ResourceConfig</A> directive.
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen<DT><CODE>conf/access.conf</CODE>
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen<DD>Contains directives that control access to documents.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenThe filename may be overridden with the
61b6d1256936065321153bcd9228b9e45d95c9abTimo Sirainen<A HREF="mod/core.html#accessconfig">AccessConfig</A> directive.
61b6d1256936065321153bcd9228b9e45d95c9abTimo Sirainen</DL>
61b6d1256936065321153bcd9228b9e45d95c9abTimo SirainenHowever, these conventions need not be adhered to.
61b6d1256936065321153bcd9228b9e45d95c9abTimo Sirainen<P>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenThe server also reads a file containing mime document types; the filename
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainenis set by the <A HREF="mod/mod_mime.html#typesconfig">TypesConfig</A>
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainendirective,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenand is <CODE>conf/mime.types</CODE> by default.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<H2>Log files</H2>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<H3>security warning</H3>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenAnyone who can write to the directory where Apache is writing a
ee26329cb5cc679b5645e4933d529f86accb976aTimo Sirainenlog file can almost certainly gain access to the uid that the server is
992a13add4eea0810e4db0f042a595dddf85536aTimo Sirainenstarted as, which is normally root. Do <EM>NOT</EM> give people write
992a13add4eea0810e4db0f042a595dddf85536aTimo Sirainenaccess to the directory the logs are stored in without being aware of
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainenthe consequences; see the <A HREF="misc/security_tips.html">security tips</A>
992a13add4eea0810e4db0f042a595dddf85536aTimo Sirainendocument for details.
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<H3>pid file</H3>
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo SirainenOn daemon startup, it saves the process id of the parent httpd process to
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainenthe file <CODE>logs/httpd.pid</CODE>. This filename can be changed with the
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen<A HREF="mod/core.html#pidfile">PidFile</A> directive. The process-id is for
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainenuse by the administrator in restarting and terminating the daemon;
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo SirainenA HUP or USR1 signal causes the daemon to re-read its configuration files and
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainena TERM signal causes it to die gracefully. For more information
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainensee the <A HREF="stopping.html">Stopping and Restarting</A> page.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<P>
61b6d1256936065321153bcd9228b9e45d95c9abTimo SirainenIf the process dies (or is killed) abnormally, then it will be necessary to
a2ce2eb4c266e2854fd34416ea5cfbe05dfd3971Timo Sirainenkill the children httpd processes.
1a5fcc972dbadfe7959011b8ad422707e2dfc19fTimo Sirainen
1a5fcc972dbadfe7959011b8ad422707e2dfc19fTimo Sirainen<H3>Error log</H3>
df6478c4cf605bd81b3891c148b84c14eb6c4035Timo SirainenThe server will log error messages to a log file, <CODE>logs/error_log</CODE>
df6478c4cf605bd81b3891c148b84c14eb6c4035Timo Sirainenby default. The filename can be set using the
a2ce2eb4c266e2854fd34416ea5cfbe05dfd3971Timo Sirainen<A HREF="mod/core.html#errorlog">ErrorLog</A> directive; different error logs
cfbf891f065b18602703ed6fa2af1a541d4d0b04Timo Sirainencan
a2ce2eb4c266e2854fd34416ea5cfbe05dfd3971Timo Sirainenbe set for different <A HREF="mod/core.html#virtualhost">virtual hosts</A>.
e9f2d9104d395bcf54be3f8ba8d9f63aecf0bcbeTimo Sirainen
e9f2d9104d395bcf54be3f8ba8d9f63aecf0bcbeTimo Sirainen<H3>Transfer log</H3>
a2ce2eb4c266e2854fd34416ea5cfbe05dfd3971Timo SirainenThe server will typically log each request to a transfer file,
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen<CODE>logs/access_log</CODE> by default. The filename can be set using a
a2ce2eb4c266e2854fd34416ea5cfbe05dfd3971Timo Sirainen<A HREF="mod/mod_log_config.html#transferlog">TransferLog</A> directive;
a2ce2eb4c266e2854fd34416ea5cfbe05dfd3971Timo Sirainendifferent transfer logs can be set for different
a2ce2eb4c266e2854fd34416ea5cfbe05dfd3971Timo Sirainen<A HREF="mod/core.html#virtualhost">virtual hosts</A>.
a2ce2eb4c266e2854fd34416ea5cfbe05dfd3971Timo Sirainen
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen<!--#include virtual="footer.html" -->
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen</BODY>
6f73af3a3a6ee900c7e736874587968d76a20bc0Timo Sirainen</HTML>
6f73af3a3a6ee900c7e736874587968d76a20bc0Timo Sirainen