78cd48acd325773619d78ac0d7263a99a8922faend<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding This file is generated from xml source: DO NOT EDIT
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<title>Starting Apache - Apache HTTP Server Version 2.5</title>
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<script src="/style/scripts/prettify.min.js" type="text/javascript">
7708bd70088b64148d7d78fd84ede43ced63c713minfrin<link href="/images/favicon.ico" rel="shortcut icon" /></head>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
59b96ad34c087942eea06884c97d12c2796a977amturk<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
2555a6b5da21d61804f47084d8fcc98eb4acbc42wrowe<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="./">Version 2.5</a></div><div id="page-content"><div id="preamble"><h1>Starting Apache</h1>
70535d6421eb979ac79d8f49d31cd94d75dd8b2fjorton<p><span>Available Languages: </span><a href="/de/invoking.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
2555a6b5da21d61804f47084d8fcc98eb4acbc42wrowe<a href="/en/invoking.html" title="English"> en </a> |
2555a6b5da21d61804f47084d8fcc98eb4acbc42wrowe<a href="/es/invoking.html" hreflang="es" rel="alternate" title="Espa�ol"> es </a> |
2555a6b5da21d61804f47084d8fcc98eb4acbc42wrowe<a href="/fr/invoking.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
2555a6b5da21d61804f47084d8fcc98eb4acbc42wrowe<a href="/ja/invoking.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
1723d9ccdd3b647f5b7bae44cab9ab3eca7a4874dougm<a href="/ko/invoking.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
e9501b71b8a1e76384cb010b1e41e76a1e47aacctrawick<a href="/tr/invoking.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p>
6335eb31f0f0ed54628a04ed32946360b8b77684minfrin <p>On Windows, Apache is normally run as a service.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding For details, see <a href="platform/windows.html#winsvc">Running Apache as a Service</a>.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding <p>On Unix, the <code class="program"><a href="/programs/httpd.html">httpd</a></code> program
2ceedfca3a2fdfdb5ff60ca17f030ce91f6331cbwrowe is run as a daemon that executes continuously in the
2ceedfca3a2fdfdb5ff60ca17f030ce91f6331cbwrowe background to handle requests. This document describes how
2ceedfca3a2fdfdb5ff60ca17f030ce91f6331cbwrowe to invoke <code class="program"><a href="/programs/httpd.html">httpd</a></code>.</p>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#startup">How Apache Starts</a></li>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding<li><img alt="" src="/images/down.gif" /> <a href="#errors">Errors During Start-up</a></li>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding<li><img alt="" src="/images/down.gif" /> <a href="#boot">Starting at Boot-Time</a></li>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding<li><img alt="" src="/images/down.gif" /> <a href="#info">Additional Information</a></li>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding</ul><h3>See also</h3><ul class="seealso"><li><a href="stopping.html">Stopping and Restarting</a></li><li><code class="program"><a href="/programs/httpd.html">httpd</a></code></li><li><code class="program"><a href="/programs/apachectl.html">apachectl</a></code></li></ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding<h2><a name="startup" id="startup">How Apache Starts</a></h2>
33cb45dc8c5106018b7c2f6ae42478b109423e0eniq <p>If the <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code>
a812b025d139f465a31c76fc02ed162ed5271b03nd specified in the configuration file is default of 80 (or any other
a812b025d139f465a31c76fc02ed162ed5271b03nd port below 1024), then it is necessary to have root privileges in
a812b025d139f465a31c76fc02ed162ed5271b03nd order to start apache, so that it can bind to this privileged
a812b025d139f465a31c76fc02ed162ed5271b03nd port. Once the server has started and performed a few preliminary
a812b025d139f465a31c76fc02ed162ed5271b03nd activities such as opening its log files, it will launch several
a812b025d139f465a31c76fc02ed162ed5271b03nd <em>child</em> processes which do the work of listening for and
a812b025d139f465a31c76fc02ed162ed5271b03nd answering requests from clients. The main <code>httpd</code>
a812b025d139f465a31c76fc02ed162ed5271b03nd process continues to run as the root user, but the child processes
a812b025d139f465a31c76fc02ed162ed5271b03nd run as a less privileged user. This is controlled by the selected
33cb45dc8c5106018b7c2f6ae42478b109423e0eniq <p>The recommended method of invoking the <code class="program"><a href="/programs/httpd.html">httpd</a></code>
a812b025d139f465a31c76fc02ed162ed5271b03nd executable is to use the <code class="program"><a href="/programs/apachectl.html">apachectl</a></code> control script. This
00211b036b78699ace57a6d800a52e6c2d57652fnd script sets certain environment variables that are necessary for
00211b036b78699ace57a6d800a52e6c2d57652fnd <code class="program"><a href="/programs/httpd.html">httpd</a></code> to function correctly under some operating
00211b036b78699ace57a6d800a52e6c2d57652fnd systems, and then invokes the <code class="program"><a href="/programs/httpd.html">httpd</a></code> binary.
a812b025d139f465a31c76fc02ed162ed5271b03nd <code class="program"><a href="/programs/apachectl.html">apachectl</a></code> will pass through any command line
a812b025d139f465a31c76fc02ed162ed5271b03nd arguments, so any <code class="program"><a href="/programs/httpd.html">httpd</a></code> options may also be used with
a812b025d139f465a31c76fc02ed162ed5271b03nd <code class="program"><a href="/programs/apachectl.html">apachectl</a></code>. You may also directly edit the
33cb45dc8c5106018b7c2f6ae42478b109423e0eniq <code class="program"><a href="/programs/apachectl.html">apachectl</a></code> script by changing the <code>HTTPD</code>
33cb45dc8c5106018b7c2f6ae42478b109423e0eniq variable near the top to specify the correct location of the
a812b025d139f465a31c76fc02ed162ed5271b03nd <code class="program"><a href="/programs/httpd.html">httpd</a></code> binary and any command-line arguments that you
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe <p>The first thing that <code class="program"><a href="/programs/httpd.html">httpd</a></code> does when it is
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe invoked is to locate and read the <a href="configuring.html">configuration file</a>
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe <code>httpd.conf</code>. The location of this file is set at
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe compile-time, but it is possible to specify its location at run
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe time using the <code>-f</code> command-line option as in</p>
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe<div class="example"><p><code>/usr/local/apache2/bin/apachectl -f
eee895b02dd7867622afd0a8a94f2efc7de9c618wrowe <p>If all goes well during startup, the server will detach from
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe the terminal and the command prompt will return almost
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe immediately. This indicates that the server is up and running.
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe You can then use your browser to connect to the server and view
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe the test page in the <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code> directory.</p>
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
9f1a88897168c3f1e5009acb585daf01e38a0299jim<h2><a name="errors" id="errors">Errors During Start-up</a></h2>
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk <p>If Apache suffers a fatal problem during startup, it will
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe write a message describing the problem either to the console or
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe to the <code class="directive"><a href="/mod/core.html#errorlog">ErrorLog</a></code> before
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe exiting. One of the most common error messages is "<code>Unable
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe to bind to Port ...</code>". This message is usually caused by
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe either:</p>
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk <li>Trying to start the server on a privileged port when not
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk logged in as the root user; or</li>
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe <li>Trying to start the server when there is another instance
c1c0628ca9788908a5fc7502d04a89c348b75ee6wrowe of Apache or some other web server already bound to the same
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk <p>For further trouble-shooting instructions, consult the
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk Apache <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a>.</p>
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe<h2><a name="boot" id="boot">Starting at Boot-Time</a></h2>
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe <p>If you want your server to continue running after a system
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe reboot, you should add a call to <code class="program"><a href="/programs/apachectl.html">apachectl</a></code> to your
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe system startup files (typically <code>rc.local</code> or a file in
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk an <code>rc.N</code> directory). This will start Apache as
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk root. Before doing this ensure that your server is properly
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe configured for security and access restrictions.</p>
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe <p>The <code class="program"><a href="/programs/apachectl.html">apachectl</a></code> script is designed to act like a
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe standard SysV init script; it can take the arguments
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe <code>start</code>, <code>restart</code>, and <code>stop</code>
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe and translate them into the appropriate signals to
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk <code class="program"><a href="/programs/httpd.html">httpd</a></code>. So you can often simply link
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk <code class="program"><a href="/programs/apachectl.html">apachectl</a></code> into the appropriate init directory. But be
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe sure to check the exact requirements of your system.</p>
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe<h2><a name="info" id="info">Additional Information</a></h2>
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe <p>Additional information about the command-line options of <code class="program"><a href="/programs/httpd.html">httpd</a></code> and <code class="program"><a href="/programs/apachectl.html">apachectl</a></code> as well as other support
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe programs included with the server is available on the
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk <a href="programs/">Server and Supporting Programs</a> page.
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk There is also documentation on all the <a href="mod/">modules</a> included with the Apache distribution
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk and the <a href="mod/directives.html">directives</a> that they
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe provide.</p>
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe<p><span>Available Languages: </span><a href="/de/invoking.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
38fd849bd99e2765ee633b6dc576b5f17acdc455wrowe<a href="/en/invoking.html" title="English"> en </a> |
9621e4c4056383e4a2b844b14687bae500b33a82wrowe<a href="/es/invoking.html" hreflang="es" rel="alternate" title="Espa�ol"> es </a> |
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk<a href="/fr/invoking.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk<a href="/ja/invoking.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk<a href="/ko/invoking.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk<a href="/tr/invoking.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p>
9621e4c4056383e4a2b844b14687bae500b33a82wrowe</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
9621e4c4056383e4a2b844b14687bae500b33a82wrowe<script type="text/javascript"><!--//--><![CDATA[//><!--
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowevar comments_shortname = 'httpd';
9621e4c4056383e4a2b844b14687bae500b33a82wrowevar comments_identifier = 'http://httpd.apache.org/docs/trunk/invoking.html';
9621e4c4056383e4a2b844b14687bae500b33a82wrowe(function(w, d) {
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
4c67ef499845a08771e81254ce6eb2324a160bc7wrowe d.write('<div id="comments_thread"><\/div>');
01261c7d9578aadd1891f94c8ee03f32ba51db3dmturk var s = d.createElement('script');
4c67ef499845a08771e81254ce6eb2324a160bc7wrowe s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
4c67ef499845a08771e81254ce6eb2324a160bc7wrowe (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
4c67ef499845a08771e81254ce6eb2324a160bc7wrowe d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe})(window, document);
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe<p class="apache">Copyright 2015 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wroweif (typeof(prettyPrint) !== 'undefined') {
1dac466bcc84f8ebf410016dcf2a4cd4312e8611wrowe prettyPrint();