windows.html.en revision 7c91f671f80fa31029a7272791f43562b5b8fb66
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd This file is generated from xml source: DO NOT EDIT
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<title>Using Apache HTTP Server on Microsoft Windows - Apache HTTP Server</title>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<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" />
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<script src="/style/scripts/prettify.js" type="text/javascript">
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/images/favicon.ico" rel="shortcut icon" /></head>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<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>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<p class="apache">Apache HTTP Server Version 2.5</p>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<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> > <a href="./">Platform Specific Notes</a></div><div id="page-content"><div id="preamble"><h1>Using Apache HTTP Server on Microsoft Windows</h1>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<p><span>Available Languages: </span><a href="/en/platform/windows.html" title="English"> en </a> |
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<a href="/ko/platform/windows.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>This document explains how to install, configure and run
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak Apache 2.5 under Microsoft Windows. If you have questions after
bc9d4698fce0238d2f6f2682e99423ebb1149976rbowen reviewing the documentation (and any event and error logs), you
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak should consult the peer-supported
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung <a href="http://httpd.apache.org/userslist.html">users' mailing
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem <p>This document assumes that you are installing a binary
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak distribution of Apache. If you want to compile Apache yourself
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak (possibly to help with development or tracking down bugs),
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak see <a href="win_compiling.html">Compiling Apache for Microsoft
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#req">Operating System Requirements</a></li>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<li><img alt="" src="/images/down.gif" /> <a href="#down">Downloading Apache for Windows</a></li>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<li><img alt="" src="/images/down.gif" /> <a href="#cust">Customizing Apache for Windows</a></li>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<li><img alt="" src="/images/down.gif" /> <a href="#winsvc">Running Apache as a Service</a></li>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<li><img alt="" src="/images/down.gif" /> <a href="#wincons">Running Apache as a Console Application</a></li>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<li><img alt="" src="/images/down.gif" /> <a href="#test">Testing the Installation</a></li>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<li><img alt="" src="/images/down.gif" /> <a href="#windrivemap">Configuring Access to Network Resources</a></li>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<h2><a name="req" id="req">Operating System Requirements</a></h2>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <p>The primary Windows platform for running Apache 2.5 is Windows
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar 2000 or later. Always obtain and
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar install the current service pack to avoid operating system bugs.</p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <div class="note">Apache HTTP Server versions later than 2.2 will not run on any
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar operating system earlier than Windows 2000.</div>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<h2><a name="down" id="down">Downloading Apache for Windows</a></h2>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <p>The Apache HTTP Server Project itself does not provide binary releases of
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar software, only source code. If you cannot compile the Apache HTTP Server
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar yourself, you can obtain a binary package from numerous binary distributions
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar available on the Internet.</p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <p>Popular options for deploying Apache httpd, and, optionally, PHP
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar and MySQL, on Microsoft Windows, include:</p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <li><a href="http://www.apachehaus.com/cgi-bin/download.plx">ApacheHaus</a></li>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <li><a href="http://www.apachelounge.com/download/">Apache Lounge</a></li>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <li><a href="http://www.wampserver.com/">WampServer</a></li>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <li><a href="http://www.apachefriends.org/en/xampp.html">XAMPP</a></li>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<h2><a name="cust" id="cust">Customizing Apache for Windows</a></h2>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <p>Apache is configured by the files in the <code>conf</code>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar subdirectory. These are the same files used to configure the Unix
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar version, but there are a few different directives for Apache on
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar Windows. See the <a href="/mod/directives.html">directive index</a>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar for all the available directives.</p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <li><p>Because Apache for Windows is multithreaded, it does not
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar use a separate process for each request, as Apache can on Unix.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar Instead there are usually only two Apache processes running: a
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar parent process, and a child which handles the requests. Within
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar the child process each request is handled by a separate thread.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <p>The process management directives are also different:</p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <p><code class="directive"><a href="/mod/mpm_common.html#maxconnectionsperchild">MaxConnectionsPerChild</a></code>:
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar Like the Unix directive, this controls how many connections a single
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar child process will serve before exiting.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar However, unlike on Unix, a replacement process is not instantly
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar available. Use the default <code>MaxConnectionsPerChild 0</code>,
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar unless instructed to change the behavior to overcome a memory leak
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar in third party modules or in-process applications.</p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <div class="warning"><strong>Warning: The server configuration
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar file is reread when a new child process is started. If you have
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar modified <code>httpd.conf</code>, the new child may not start or
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <p><code class="directive"><a href="/mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code>:
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar This directive is new. It tells the server how many threads it
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar should use. This is the maximum number of connections the server
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar can handle at once, so be sure to set this number high enough for
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar your site if you get a lot of hits. The recommended default is
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <code>ThreadsPerChild 150</code>, but this must be adjusted to
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar reflect the greatest anticipated number of simultaneous
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <li><p>The directives that accept filenames as arguments must use
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar Windows filenames instead of Unix ones. However, because Apache
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar may interpret backslashes as an "escape character" sequence, you
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar should consistently use forward slashes in path names, not
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <li><p>While filenames are generally case-insensitive on
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar Windows, URLs are still treated internally as case-sensitive
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar before they are mapped to the filesystem. For example, the
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <code class="directive"><a href="/mod/core.html#location"><Location></a></code>,
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <code class="directive"><a href="/mod/mod_alias.html#alias">Alias</a></code>, and <code class="directive"><a href="/mod/mod_proxy.html#proxypass">ProxyPass</a></code> directives all use
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar case-sensitive arguments. For this reason, it is particularly
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar important to use the <code class="directive"><a href="/mod/core.html#directory"><Directory></a></code> directive when attempting
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar to limit access to content in the filesystem, since this
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar directive applies to any content in a directory, regardless of
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar how it is accessed. If you wish to assure that only lowercase
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar is used in URLs, you can use something like:</p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarRewriteEngine On
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarRewriteMap lowercase int:tolower
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarRewriteCond %{REQUEST_URI} [A-Z]
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarRewriteRule (.*) ${lowercase:$1} [R,L]
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <li><p>When running, Apache needs write access only to the logs
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar directory and any configured cache directory tree. Due to the
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar issue of case insensitive and short 8.3 format names, Apache must
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar validate all path names given. This means that each directory
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar which Apache evaluates, from the drive root up to the directory
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar leaf, must have read, list and traverse directory permissions.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar If Apache2.5 is installed at C:\Program Files, then the root
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar directory, Program Files and Apache2.5 must all be visible
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <li><p>Apache for Windows contains the ability to load modules at
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar runtime, without recompiling the server. If Apache is compiled
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar normally, it will install a number of optional modules in the
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <code>\Apache2.5\modules</code> directory. To activate these or
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar other modules, the new <code class="directive"><a href="/mod/mod_so.html#loadmodule">LoadModule</a></code>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak directive must be used. For example, to activate the status
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak module, use the following (in addition to the status-activating
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>Information on <a href="/mod/mod_so.html#creating">creating
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <li><p>Apache can also load ISAPI (Internet Server Application
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak Programming Interface) extensions such as those used by Microsoft
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak IIS and other Windows servers. <a href="/mod/mod_isapi.html">More
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak information is available</a>. Note that Apache <strong>cannot</strong>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak load ISAPI Filters, and ISAPI Handlers with some Microsoft feature
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <li><p>When running CGI scripts, the method Apache uses to find
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak the interpreter for the script is configurable using the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <code class="directive"><a href="/mod/core.html#scriptinterpretersource">ScriptInterpreterSource</a></code>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <li><p>Since it is often difficult to manage files with names
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak like <code>.htaccess</code> in Windows, you may find it useful to
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak change the name of this per-directory configuration file using
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak the <code class="directive"><a href="/mod/core.html#accessfilename">AccessFilename</a></code>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <li><p>Any errors during Apache startup are logged into the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak Windows event log when running on Windows NT. This mechanism
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak acts as a backup for those situations where Apache is not yet
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak prepared to use the <code>error.log</code> file. You can
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak review the Windows Application Event Log by using the Event Viewer,
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak e.g. Start - Settings - Control Panel - Administrative Tools
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak<h2><a name="winsvc" id="winsvc">Running Apache as a Service</a></h2>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>Apache comes with a utility called the Apache Service Monitor.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak With it you can see and manage the state of all installed Apache
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak services on any machine on your network. To be able to manage an
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak Apache service with the monitor, you have to first install the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak service (either automatically via the installation or manually).
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>You can install Apache as a Windows NT service as follows from
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak the command prompt at the Apache <code>bin</code> subdirectory:</p>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>If you need to specify the name of the service you want to
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak install, use the following command. You have to do this if you
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak have several different service installations of Apache on your
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak computer. If you specify a name during the install, you have to
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak also specify it during any other -k operation.</p>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak httpd.exe -k install -n "MyServiceName"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>If you need to have specifically named configuration files for
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak different services, you must use this:</p>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak httpd.exe -k install -n "MyServiceName" -f "c:\files\my.conf"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>If you use the first command without any special parameters except
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <code>-k install</code>, the service will be called <code>Apache2.5</code>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak and the configuration will be assumed to be <code>conf\httpd.conf</code>.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>Removing an Apache service is easy. Just use:</p>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>The specific Apache service to be uninstalled can be specified by using:</p>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak httpd.exe -k uninstall -n "MyServiceName"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>Normal starting, restarting and shutting down of an Apache
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak service is usually done via the Apache Service Monitor, by using
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak commands like <code>NET START Apache2.5</code> and <code>NET STOP
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak Apache2.5</code> or via normal Windows service management. Before
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak starting Apache as a service by any means, you should test the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak service's configuration file by using:</p>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak httpd.exe -n "MyServiceName" -t
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>You can control an Apache service by its command line switches,
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak too. To start an installed Apache service you'll use this:</p>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak httpd.exe -k start -n "MyServiceName"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>To stop an Apache service via the command line switches, use
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak httpd.exe -k stop -n "MyServiceName"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak httpd.exe -k shutdown -n "MyServiceName"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>You can also restart a running service and force it to reread
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak its configuration file by using:</p>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak httpd.exe -k restart -n "MyServiceName"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>By default, all Apache services are registered to run as the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak system user (the <code>LocalSystem</code> account). The
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <code>LocalSystem</code> account has no privileges to your network
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak via any Windows-secured mechanism, including the file system, named
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak pipes, DCOM, or secure RPC. It has, however, wide privileges locally.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <div class="warning"><strong>Never grant any network privileges to
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak the <code>LocalSystem</code> account! If you need Apache to be able
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak to access network resources, create a separate account for Apache as
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <p>It is recommended that users create a separate account for running
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak Apache service(s). If you have to access network resources via Apache,
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak this is required.</p>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <li>Create a normal domain user account, and be sure to
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak memorize its password.</li>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <li>Grant the newly-created user a privilege of <code>Log on
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak as a service</code> and <code>Act as part of the operating
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak system</code>. On Windows NT 4.0 these privileges are granted via
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak User Manager for Domains, but on Windows 2000 and XP you probably
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak want to use Group Policy for propagating these settings. You can
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak also manually set these via the Local Security Policy MMC snap-in.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <li>Confirm that the created account is a member of the Users
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak group.</li>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <li>Grant the account read and execute (RX) rights to all document
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak and script folders (<code>htdocs</code> and <code>cgi-bin</code>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak for example).</li>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <li>Grant the account change (RWXD) rights to the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <li>Grant the account read and execute (RX) rights to the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <div class="note">It is usually a good practice to grant the user the Apache
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak service runs as read and execute (RX) access to the whole Apache2.5
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak directory, except the <code>logs</code> subdirectory, where the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak user has to have at least change (RWXD) rights.</div>
bc9d4698fce0238d2f6f2682e99423ebb1149976rbowen <p>If you allow the account to log in as a user and as a service,
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak then you can log on with that account and test that the account has
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung the privileges to execute the scripts, read the web pages, and that
727872d18412fc021f03969b8641810d8896820bhumbedooh you can start Apache in a console window. If this works, and you
0d0ba3a410038e179b695446bb149cce6264e0abnd have followed the steps above, Apache should execute as a service
727872d18412fc021f03969b8641810d8896820bhumbedooh with no problems.</p>
0d0ba3a410038e179b695446bb149cce6264e0abnd <div class="note"><strong>Error code 2186</strong> is a good indication that
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh you need to review the "Log On As" configuration for the service,
727872d18412fc021f03969b8641810d8896820bhumbedooh since Apache cannot access a required network resource. Also, pay
0d0ba3a410038e179b695446bb149cce6264e0abnd close attention to the privileges of the user Apache is
0d0ba3a410038e179b695446bb149cce6264e0abnd configured to run as.</div>
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh <p>When starting Apache as a service you may encounter an error
0d0ba3a410038e179b695446bb149cce6264e0abnd message from the Windows Service Control Manager. For example,
0d0ba3a410038e179b695446bb149cce6264e0abnd if you try to start Apache by using the Services applet in the
0d0ba3a410038e179b695446bb149cce6264e0abnd Windows Control Panel, you may get the following message:</p>
0d0ba3a410038e179b695446bb149cce6264e0abnd Could not start the Apache2.5 service on \\COMPUTER <br />
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh Error 1067; The process terminated unexpectedly.
0d0ba3a410038e179b695446bb149cce6264e0abnd <p>You will get this generic error if there is any problem with
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd starting the Apache service. In order to see what is really causing
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd the problem you should follow the instructions for Running Apache
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd for Windows from the Command Prompt.</p>
you follow the instructions below to try starting httpd.exe from
httpd.exe -k shutdown
httpd.exe -k restart
more < error.log
httpd.exe -n "MyServiceName"
httpd.exe -V
<p>Apache will then try to determine its <code class="directive"><a href="/mod/core.html#serverroot">ServerRoot</a></code> by trying the following, in this order:</p>
this file contains a <code class="directive"><a href="/mod/core.html#serverroot">ServerRoot</a></code>
<div class="example"><h3>Example DocumentRoot with UNC path</h3><pre class="prettyprint lang-config">
<div class="example"><h3>Example DocumentRoot with IP address in UNC path</h3><pre class="prettyprint lang-config">
<div class="example"><h3>Example Alias and corresponding Directory with UNC path</h3><pre class="prettyprint lang-config">
<p><span>Available Languages: </span><a href="/en/platform/windows.html" title="English"> en </a> |
<a href="/ko/platform/windows.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
</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>
var comments_identifier = 'http://httpd.apache.org/docs/trunk/platform/windows.html';
if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
d.write('<div id="comments_thread"><\/div>');
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
(d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
<p class="apache">Copyright 2013 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>
<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[//><!--