invoking.html.en revision a01a25d738ef02bac5955f731e88bd05b0d59314
cac0964f155bdb6daba7ecf5628ed2fec3763275orlikowski<?xml version="1.0" encoding="ISO-8859-1"?>
7238b345c345cb79d81cf01fedc311bff001444ctrawick<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
d8ed1028025480c672d9dc7266b54ac853bbb999trawick XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
d8ed1028025480c672d9dc7266b54ac853bbb999trawick This file is generated from xml source: DO NOT EDIT
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin -->
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin<title>Starting Apache - Apache HTTP Server</title>
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
c8d61b81105661b9ba169482e418929fcf0cfec4trawick<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
87a87c1e1afc7eb004bc10594a9de98411866a20jerenkrantz<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb<link href="/images/favicon.ico" rel="shortcut icon" /></head>
1ddf25b77b03f7f4fd7a7676b62755da90cd3e0crbb<body id="manual-page"><div id="page-header">
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
7aae0c3ef8e7f18f57e2712815c7b48358e5ff68rbb<p class="apache">Apache HTTP Server Version 2.1</p>
4b34d6a5b70303010612df6c87da3ee91ae86078rbb<img alt="" src="/images/feather.gif" /></div>
4b34d6a5b70303010612df6c87da3ee91ae86078rbb<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
4b34d6a5b70303010612df6c87da3ee91ae86078rbb<div id="path">
4b34d6a5b70303010612df6c87da3ee91ae86078rbb<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs-project/">Documentation</a> &gt; <a href="./">Version 2.1</a></div><div id="page-content"><div id="preamble"><h1>Starting Apache</h1>
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin <p>On Windows, Apache is normally run as a service on Windows
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin NT, 2000 and XP, or as a console application on Windows 9x and
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin ME. For details, see <a href="platform/windows.html#winsvc">Running Apache as a Service</a>
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin and <a href="platform/windows.xml#wincons">Running Apache as a
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin Console Application</a>.</p>
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin <p>On Unix, the <a href="programs/httpd.html">httpd</a> program
d66260b801a953237f71d6a4b26d8fd9ea419e3brbb is run as a daemon that executes continuously in the
4b34d6a5b70303010612df6c87da3ee91ae86078rbb background to handle requests. This document describes how
4b34d6a5b70303010612df6c87da3ee91ae86078rbb to invoke <code>httpd</code>.</p>
d66260b801a953237f71d6a4b26d8fd9ea419e3brbb</div>
d66260b801a953237f71d6a4b26d8fd9ea419e3brbb<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#startup">How Apache Starts</a></li>
d472f67198d6b15dd1270136f180cca9c9263243trawick<li><img alt="" src="/images/down.gif" /> <a href="#errors">Errors During Start-up</a></li>
4b34d6a5b70303010612df6c87da3ee91ae86078rbb<li><img alt="" src="/images/down.gif" /> <a href="#boot">Starting at Boot-Time</a></li>
4b34d6a5b70303010612df6c87da3ee91ae86078rbb<li><img alt="" src="/images/down.gif" /> <a href="#info">Additional Information</a></li>
4b34d6a5b70303010612df6c87da3ee91ae86078rbb</ul><h3>See also</h3><ul class="seealso"><li><a href="stopping.html">Stopping and Restarting</a></li><li><a href="programs/httpd.html">httpd</a></li><li><a href="programs/apachectl.html">apachectl</a></li></ul></div>
d472f67198d6b15dd1270136f180cca9c9263243trawick<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
d472f67198d6b15dd1270136f180cca9c9263243trawick<div class="section">
7aae0c3ef8e7f18f57e2712815c7b48358e5ff68rbb<h2><a name="startup" id="startup">How Apache Starts</a></h2>
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb <p>If the <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code>
37be7bf671bdb30d0689796a1a15cc47666e5b78sf specified in the configuration file is default of 80 (or any other
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb port below 1024), then it is necessary to have root privileges in
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb order to start apache, so that it can bind to this privileged
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb port. Once the server has started and performed a few preliminary
8a3a703eae0e35f674b189181609545c6fc77a09rbb activities such as opening its log files, it will launch several
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb <em>child</em> processes which do the work of listening for and
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb answering requests from clients. The main <code>httpd</code>
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb process continues to run as the root user, but the child processes
8a3a703eae0e35f674b189181609545c6fc77a09rbb run as a less privileged user. This is controlled by the selected
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb <a href="mpm.html">Multi-Processing Module</a>.</p>
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb <p>The recommended method of invoking the <code>httpd</code>
8a3a703eae0e35f674b189181609545c6fc77a09rbb executable is to use the <a href="programs/apachectl.html">apachectl</a> control script. This
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb script sets certain environment variables that are necessary for
7e27b1d417fa94db6e8c798a36c68de3a22f3937ianh <code>httpd</code> to function correctly under some operating
7e27b1d417fa94db6e8c798a36c68de3a22f3937ianh systems, and then invokes the <code>httpd</code> binary.
37be7bf671bdb30d0689796a1a15cc47666e5b78sf <code>apachectl</code> will pass through any command line
7e27b1d417fa94db6e8c798a36c68de3a22f3937ianh arguments, so any <code>httpd</code> options may also be used with
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb <code>apachectl</code>. You may also directly edit the
cd04c96e193a6bd4624d92382fd83bda52c8b170rjung <code>apachectl</code> script by changing the <code>HTTPD</code>
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb variable near the top to specify the correct location of the
164141857c02667118df04b14fe536d1756f0ef4jorton <code>httpd</code> binary and any command-line arguments that you
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb wish to be <em>always</em> present.</p>
cee52fb06eb61191ce5d495abda58a75a9bb1c4fcoar
cee52fb06eb61191ce5d495abda58a75a9bb1c4fcoar <p>The first thing that <code>httpd</code> does when it is
cee52fb06eb61191ce5d495abda58a75a9bb1c4fcoar invoked is to locate and read the <a href="configuring.html">configuration file</a>
cee52fb06eb61191ce5d495abda58a75a9bb1c4fcoar <code>httpd.conf</code>. The location of this file is set at
bb7f455a6c49400b3dfcb3dfb84f9c3a32947a08rbb compile-time, but it is possible to specify its location at run
bb7f455a6c49400b3dfcb3dfb84f9c3a32947a08rbb time using the <code>-f</code> command-line option as in</p>
e3c1e71cb730f73117078f976452574f9a3c840cjorton
bb7f455a6c49400b3dfcb3dfb84f9c3a32947a08rbb<div class="example"><p><code>/usr/local/apache2/bin/apachectl -f
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /usr/local/apache/conf/httpd.conf</code></p></div>
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz <p>If all goes well during startup, the server will detach from
e62b34b26eb8e82bf6f06ff99a08e304b48792ecpquerna the terminal and the command prompt will return almost
e62b34b26eb8e82bf6f06ff99a08e304b48792ecpquerna immediately. This indicates that the server is up and running.
e62b34b26eb8e82bf6f06ff99a08e304b48792ecpquerna You can then use your browser to connect to the server and view
e62b34b26eb8e82bf6f06ff99a08e304b48792ecpquerna the test page in the <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code> directory
e62b34b26eb8e82bf6f06ff99a08e304b48792ecpquerna and the local copy of the documentation linked from that
05aeb72ad4d3487297de9b6a27e9d61cbd7672a8rooneg page.</p>
05aeb72ad4d3487297de9b6a27e9d61cbd7672a8rooneg</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
05aeb72ad4d3487297de9b6a27e9d61cbd7672a8rooneg<div class="section">
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin<h2><a name="errors" id="errors">Errors During Start-up</a></h2>
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin <p>If Apache suffers a fatal problem during startup, it will
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin write a message describing the problem either to the console or
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin to the <code class="directive"><a href="/mod/core.html#errorlog">ErrorLog</a></code> before
exiting. One of the most common error messages is "<code>Unable
to bind to Port ...</code>". This message is usually caused by
either:</p>
<ul>
<li>Trying to start the server on a privileged port when not
logged in as the root user; or</li>
<li>Trying to start the server when there is another instance
of Apache or some other web server already bound to the same
Port.</li>
</ul>
<p>For further trouble-shooting instructions, consult the
Apache <a href="faq/">FAQ</a>.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
<div class="section">
<h2><a name="boot" id="boot">Starting at Boot-Time</a></h2>
<p>If you want your server to continue running after a system
reboot, you should add a call to <code>apachectl</code> to your
system startup files (typically <code>rc.local</code> or a file in
an <code>rc.N</code> directory). This will start Apache as
root. Before doing this ensure that your server is properly
configured for security and access restrictions.</p>
<p>The <code>apachectl</code> script is designed to act like a
standard SysV init script; it can take the arguments
<code>start</code>, <code>restart</code>, and <code>stop</code>
and translate them into the appropriate signals to
<code>httpd</code>. So you can often simply link
<code>apachectl</code> into the appropriate init directory. But be
sure to check the exact requirements of your system.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
<div class="section">
<h2><a name="info" id="info">Additional Information</a></h2>
<p>Additional information about the command-line options of <a href="programs/httpd.html">httpd</a> and <a href="programs/apachectl.html">apachectl</a> as well as other
support programs included with the server is available on the
<a href="programs/">Server and Supporting Programs</a> page.
There is also documentation on all the <a href="mod/">modules</a> included with the Apache distribution
and the <a href="mod/directives.html">directives</a> that they
provide.</p>
</div></div>
<div id="footer">
<p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p>
<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>
</body></html>