windows.html revision 8f65063a24063360523054ed434a65596bc24cc2
2cacab200fb387e290386593d9b2fca2e7beef33csovant<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2cacab200fb387e290386593d9b2fca2e7beef33csovant<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant BGCOLOR="#FFFFFF"
2cacab200fb387e290386593d9b2fca2e7beef33csovant TEXT="#000000"
2cacab200fb387e290386593d9b2fca2e7beef33csovant LINK="#0000FF"
2cacab200fb387e290386593d9b2fca2e7beef33csovant VLINK="#000080"
2cacab200fb387e290386593d9b2fca2e7beef33csovant ALINK="#FF0000"
2cacab200fb387e290386593d9b2fca2e7beef33csovant<!--#include virtual="header.html" -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant<H1 ALIGN="CENTER">Using Apache With Microsoft Windows</H1>
2cacab200fb387e290386593d9b2fca2e7beef33csovant<P>This document explains how to install, configure and run
2cacab200fb387e290386593d9b2fca2e7beef33csovant Apache 1.3b6 and later under Microsoft Windows. Please note that at
2cacab200fb387e290386593d9b2fca2e7beef33csovant this time, Windows support is entirely experimental, and is
2cacab200fb387e290386593d9b2fca2e7beef33csovant recommended only for experienced users. The Apache Group does not
2cacab200fb387e290386593d9b2fca2e7beef33csovant guarantee that this software will work as documented, or even at
2cacab200fb387e290386593d9b2fca2e7beef33csovant all. If you find any bugs, or wish to contribute in other ways, please
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant use our <A HREF="http://www.apache.org/bug_report.html">bug reporting
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<P><STRONG>Warning: Apache on NT has not yet been optimized for performance.
2cacab200fb387e290386593d9b2fca2e7beef33csovantApache still performs best, and is most reliable on Unix platforms. Over
2cacab200fb387e290386593d9b2fca2e7beef33csovanttime we will improve NT performance. Folks doing comparative reviews
2cacab200fb387e290386593d9b2fca2e7beef33csovantof webserver performance are asked to compare against Apache
2cacab200fb387e290386593d9b2fca2e7beef33csovanton a Unix platform such as Solaris, FreeBSD, or Linux.</STRONG></P>
a36d934612ff23d33c1ff20f05d59db05abeca26madiotMost of this document assumes that you are installing Windows from a
a36d934612ff23d33c1ff20f05d59db05abeca26madiotbinary distribution. If you want to compile Apache yourself (possibly
a36d934612ff23d33c1ff20f05d59db05abeca26madiotto help with development, or to track down bugs), see the section on
a36d934612ff23d33c1ff20f05d59db05abeca26madiot<A HREF="#comp">Compiling Apache for Windows</A> below.
a36d934612ff23d33c1ff20f05d59db05abeca26madiot <LI><A HREF="#down">Downloading Apache for Windows</A>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <LI><A HREF="#inst">Installing Apache for Windows (binary install)</A>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <LI><A HREF="#cmdline">Running Apache for Windows from the Command Line</A>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <LI><A HREF="#signal">Signalling Apache when running</A>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant <LI><A HREF="#comp">Compiling Apache for Windows</A>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantApache 1.3 is designed to run on Windows NT 4.0. The binary installer
2cacab200fb387e290386593d9b2fca2e7beef33csovantwill only work in Intel processors. Apache may also run on Windows 95
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantand Windows NT 3.5.1, but these have not been tested. In all cases
2cacab200fb387e290386593d9b2fca2e7beef33csovantIf running on Windows 95, using the "Winsock2" upgrade is recommended
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantbut may not be necessary. If running on NT 4.0, installing Service Pack 2
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantis recommended.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<H2><A NAME="down">Downloading Apache for Windows</A></H2>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<P>Information on the latest version of Apache can be found on the
2cacab200fb387e290386593d9b2fca2e7beef33csovantApache web server at <A
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantHREF="http://www.apache.org/">http://www.apache.org/</A>. This will
2cacab200fb387e290386593d9b2fca2e7beef33csovantlist the current release, any more recent alpha or beta-test releases,
2cacab200fb387e290386593d9b2fca2e7beef33csovanttogether with details of mirror web and anonymous ftp sites.</P>
2cacab200fb387e290386593d9b2fca2e7beef33csovantYou should download the version of Apache for Windows with the
2cacab200fb387e290386593d9b2fca2e7beef33csovant<CODE>.exe</CODE> extension. This is a single file containing Apache,
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantready to install and run. There may also be a <CODE>.zip</CODE> file
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantcontaining the source code, to compile Apache yourself. (If there is
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantno <SAMP>.zip</SAMP> file, the source will be available in a
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<SAMP>.tar.gz</SAMP> file but this will contain Unix line endings. You
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantwill have to convert at least the <SAMP>.mak</SAMP> and
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<SAMP>.dsp</SAMP> files to have DOS line endings before MSVC will
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantunderstand them).
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<H2><A NAME="inst">Installing Apache for Windows</A></H2>
2cacab200fb387e290386593d9b2fca2e7beef33csovantRun the Apache <SAMP>.exe</SAMP> file you downloaded above. This will
2cacab200fb387e290386593d9b2fca2e7beef33csovant <LI>the directory to install Apache into (the default is
2cacab200fb387e290386593d9b2fca2e7beef33csovant <CODE>\Program Files\Apache Group\Apache</CODE> although you can
2cacab200fb387e290386593d9b2fca2e7beef33csovant change this to any other directory)
2cacab200fb387e290386593d9b2fca2e7beef33csovant <LI>the start menu name (default is "Apache Web Server")
2cacab200fb387e290386593d9b2fca2e7beef33csovant <LI>the installation type. The "Typical" option installs
2cacab200fb387e290386593d9b2fca2e7beef33csovant everything except the source code. The "Minimum" option does not
2cacab200fb387e290386593d9b2fca2e7beef33csovant install the manuals or source code. Choose the "Custom" install if
2cacab200fb387e290386593d9b2fca2e7beef33csovant you want to install the source code.
2cacab200fb387e290386593d9b2fca2e7beef33csovantDuring the installation, Apache will configure the files in the
2cacab200fb387e290386593d9b2fca2e7beef33csovant<SAMP>conf</SAMP> directory for your chosen installation
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantdirectory. However if any of the files in this directory already exist
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantthey will <STRONG>not</STRONG> be overwritten. Instead the new copy of
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantthe corresponding file will be left with the extension
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<SAMP>conf\httpd.conf</SAMP> already exists it will not be altered,
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantbut the version which would have been installed will be left in
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<SAMP>conf\httpd.conf.default</SAMP>. After the installation has
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantfinished you should manually check to see what in new in the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<SAMP>.default</SAMP> file, and if necessary update your existing
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantconfiguration files.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantAlso, if you already have a file called <SAMP>htdocs\index.html</SAMP>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantthen it will not be overwritten (no <SAMP>index.html.default</SAMP>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantfile will be installed either). This should mean it a safe to install
2cacab200fb387e290386593d9b2fca2e7beef33csovantApache over an existing installation (but you will have to stop the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantexisting server running before doing the installation, then start the
2cacab200fb387e290386593d9b2fca2e7beef33csovantnew one after the installation is finished).
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<BLOCKQUOTE>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<STRONG>Important note for 1.3b6 installs</STRONG>: the above only
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantapplies for 1.3b7 and later. In 1.3b6 the installer would overwrite
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swiftany existing <SAMP>httpd.conf</SAMP>, <SAMP>access.conf</SAMP>,
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<SAMP>srm.conf</SAMP> or <SAMP>mime.types</SAMP> files in the
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift<SAMP>conf</SAMP>, and will also overwrite your
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<SAMP>index.html</SAMP> file in the <SAMP>htdocs</SAMP> directory. You
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantshould copy these files or directories before installing Apache 1.3b6
2cacab200fb387e290386593d9b2fca2e7beef33csovantor install into a new directory.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant</BLOCKQUOTE>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantAfter installing Apache, you should edit the configuration files in
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swiftthe <SAMP>conf</SAMP> directory as required. These files will be
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantconfigured during the install ready for Apache to be run from the
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swiftdirectory where it was installed, with the documents served from the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantsubdirectory <SAMP>htdocs</SAMP>. There are lots of other options
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantwhich should be set before you start really using Apache. However to
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantget started quickly the files should work as installed.
2cacab200fb387e290386593d9b2fca2e7beef33csovant<H2><A NAME="run">Running Apache for Windows</A></H2>
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swiftThere are two ways you can run Apache:
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift <LI>As a "service" (available on NT only). This is the best option if
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift you want Apache to automatically start when you machine boots, and to
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift keep Apache running when you log-off.
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift <LI>From a <A HREF="#cmdline">console window</A>. This is the only option
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift available for
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift Windows 95 users.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantTo start Apache as a service, you first need to install it as a
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantservice. Run the "Install Apache as Service" option from the Start
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantmenu. Once this is done you can start Apache by opening the Services
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantwindow (in the Control Panel), selecting Apache, then clicking on
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantStart. Apache will now be running in the background. You can later
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantstop Apache by clicking on Stop. As an alternative to using the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantServices window, you can start and stop Apache from the control line
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant NET START APACHE
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant NET STOP APACHE
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantTo run Apache from a console window, select the "Apache Server" option
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantfrom the Start menu. This will open a console window and start Apache
2cacab200fb387e290386593d9b2fca2e7beef33csovantrunning inside it. The window will remain active until you stop
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantApache. To stop Apache running, see <A HREF="#signal>Signalling Apache
2cacab200fb387e290386593d9b2fca2e7beef33csovantwhen Running</SAMP>.
2cacab200fb387e290386593d9b2fca2e7beef33csovantAfter starting Apache running (either in a console window or as a
2cacab200fb387e290386593d9b2fca2e7beef33csovantservice) if will be listening to port 80 (unless you changed the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<SAMP>Port</SAMP>, <SAMP>Listen</SAMP> or <SAMP>BindAddress</SAMP>
2cacab200fb387e290386593d9b2fca2e7beef33csovantdirectives in the configuration files). To connect to the server and
2cacab200fb387e290386593d9b2fca2e7beef33csovantaccess the default page, launch a browser and enter this URL:
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantThis should respond with a welcome page, and a link to the Apache
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantmanual. If nothing happens or you get an error, look in the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<SAMP>error_log</SAMP> file in the <SAMP>logs</SAMP> directory.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantOnce your basic installation is working, you should configure it
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantproperly by editing the files in the <SAMP>conf</SAMP> directory.
2cacab200fb387e290386593d9b2fca2e7beef33csovant<H2><A NAME="use">Configuring Apache for Windows</A></H2>
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swiftApache is configured by files in the <SAMP>conf</SAMP>
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swiftdirectory. These are the same as files used to configure the Unix
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swiftversion, but there are a few different directives for Apache on
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantWindows. See the <A HREF="./">Apache documentation</A> for all the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantavailable directives.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantThe main differences in Apache for Windows are:
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant <LI><P>Because Apache for Windows is multithreaded, it does not use a
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant separate process for each request, as Apache does with
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant Unix. Instead there are usually only two Apache processes running:
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant a parent process, and a child which handles the requests. Within
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant the child each request is handled by a separate thread.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant So the "process"-management directives are different:
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant HREF="mod/core.html#maxrequestsperchild">MaxRequestsPerChild</A>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant - Like the Unix directive, this controls how many requests a
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant process will serve before exiting. However, unlike Unix, a
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant process serves all the requests at once, not just one, so if
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant this is set, it is recommended that a very high number is
2cacab200fb387e290386593d9b2fca2e7beef33csovant used. The recommended default, <CODE>MaxRequestsPerChild
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant 0</CODE>, does not cause the process to ever exit.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant <P><A HREF="mod/core.html#threadsperchild">ThreadsPerChild</A> -
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant This directive is new, and tells the server how many threads it
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant should use. This is the maximum number of connections the server
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant can handle at once; be sure and set this number high enough for
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant your site if you get a lot of hits. The recommended default is
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant <CODE>ThreadsPerChild 50</CODE>.</P>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <LI><P>The directives that accept filenames as arguments now must use
2cacab200fb387e290386593d9b2fca2e7beef33csovant Windows filenames instead of Unix ones. However, because Apache
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant uses Unix-style names internally, you must use forward slashes, not
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant backslashes. Drive letters can be used; if omitted, the drive with
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant the Apache executable will be assumed.</P>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant <LI><P>Apache for Windows contains the ability to load modules at runtime,
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant without recompiling the server. If Apache is compiled normally, it
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant will install a number of optional modules in the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant <CODE>\Apache\modules</CODE> directory. To activate these, or other
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant modules, the new <A HREF="mod/mod_so.html#loadmodule">LoadModule</A>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant directive must be used. For example, to active the status module,
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant use the following (in addition to the status-activating directives
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant in <CODE>access.conf</CODE>):</P>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant LoadModule status_module modules/ApacheModuleStatus.dll
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant <P>Information on <A HREF="mod/mod_so.html#creating">creating loadable
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant modules</A> is also available.</P>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant <LI><P>Apache can also load ISAPI Extensions (<EM>i.e.</EM>, Internet Server
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant Applications), such as those used by Microsoft's IIS, and other
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant Windows servers. <A HREF="mod/mod_isapi.html">More information
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant is available.</A>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<H2><A NAME="cmdline">Running Apache for Windows from the Command Line</A></H2>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantThe Start menu icons and the NT Service manager can provide an simple
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantinterafce for administering Apache. But in some cases it is easier to
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantwork from the command line.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantWhen working with Apache it is important to know how it will find the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantconfiguration files. Apache will try one of the following, in this order.
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift<LI>A ServerRoot directive via a -C switch.
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift<LI>The -f switch on the command line.
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift<LI>The -d switch on the command line.
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift<LI>A registry entry, created if you did a binary install.
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift<LI>The server root compiled into the server.
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swiftThe server root compiled into the server is usually "/apache".
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantinvoking apache with the -v switch will display this value
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantlabeled as HTTPD_ROOT.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantYour current working directory when Apache is started up has no
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovanteffect on Apache's behavior.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantUnder windows, when invoked from the start menu or the Service Manager Apache is
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantusually passed no arguments. So using the registry entry is the perfered
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantDuring a binary installation, a registry key will have
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantbeen installed, for example:
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant HKEY_LOCAL_MACHINE\Software\Apache Group\Apache\1.3.1\ServerRoot
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantThis key is compiled into the server and can enable you to test
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantnew versions without affecting the current version. Of course
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantyou must take care not to install the new version on top of the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantold version in the file system. You can not run two invocations
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantof Apache on Windows simultaneously.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantIf you did not do a binary install then Apache will in some
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantsenarios complain that about the missing registry key. This
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantwarning can be ignored if it otherwise was able to find it's
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantconfiguration files.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantThe value of this key is the "ServerRoot" directory, containing the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<SAMP>conf</SAMP> directory. When Apache starts it will read the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<SAMP>httpd.conf</SAMP> file from this directory. If this file
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantcontains a <SAMP>ServerRoot</SAMP> directive which is different from
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantthe directory obtained from the registry key above, Apache will forget
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantthe registry key and use the directory from the configuration file.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantIf you copy the Apache directory or configuration files to a new
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantlocation it is vital that you update the <SAMP>ServerRoot</SAMP>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantdirectory in the <SAMP>httpd.conf</SAMP> file to the new location.
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantTo run Apache from the command line as a console application, use the
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantfollowing command:
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantApache will execute, and will remain running until it is stopped by pressing
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantcontrol-C. (The -s option is not required by Windows 95, but on Windows NT it
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantprevents Apache waiting to see if Apache is running as a service.)
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantTo install Apache as a Windows NT service as follows:
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantand to remove the Apache service, use
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovant<H2><A NAME="signal">Signalling Apache when running</A></H2>
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantOn Windows 95 Apache runs as a console application. You can tell a
23f633e1b8cc53fdac740eca4ab7e0341890bba2csovantrunning Apache to stop by opening another console window and running
2cacab200fb387e290386593d9b2fca2e7beef33csovant apache -k shutdown
2cacab200fb387e290386593d9b2fca2e7beef33csovantThis should be used instead of pressing Control-C in the running
2cacab200fb387e290386593d9b2fca2e7beef33csovantApache console window, because it lets Apache end any current
2cacab200fb387e290386593d9b2fca2e7beef33csovanttransactions and cleanup gracefully.
2cacab200fb387e290386593d9b2fca2e7beef33csovantYou can also tell Apache to restart. This makes it re-read the
2cacab200fb387e290386593d9b2fca2e7beef33csovantconfiguration files. Any transactions in progress are allowed to
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiotcomplete without interruption. To restart Apache, run
2cacab200fb387e290386593d9b2fca2e7beef33csovant apache -k restart
2cacab200fb387e290386593d9b2fca2e7beef33csovantNote for people familiar with the Unix version of Apache: these
2cacab200fb387e290386593d9b2fca2e7beef33csovantcommands provide a Windows equivalent to <CODE>kill -TERM
2cacab200fb387e290386593d9b2fca2e7beef33csovant<i>pid</i></CODE> and <CODE>kill -USR1 <i>pid</i></CODE>. The command
2cacab200fb387e290386593d9b2fca2e7beef33csovantline option used, <CODE>-k</CODE>, was chosen as a reminder of the
2cacab200fb387e290386593d9b2fca2e7beef33csovant<H2><A NAME="comp">Compiling Apache for Windows</A></H2>
2cacab200fb387e290386593d9b2fca2e7beef33csovant<P>Compiling Apache requires Microsoft Visual C++ 5.0 to be properly
2cacab200fb387e290386593d9b2fca2e7beef33csovant installed. It is easiest to compile with the command-line tools
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot (nmake, <EM>etc.</EM>..). Consult the VC++ manual to determine how to install
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot<P>First, unpack the Apache distribution into an appropriate
2cacab200fb387e290386593d9b2fca2e7beef33csovant directory. Open a command-line prompt, and change to the
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot <CODE>src</CODE> subdirectory of the Apache distribution.</P>
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot<P>The master Apache makefile instructions are contained in the
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot <CODE>Makefile.nt</CODE> file. To compile Apache, simply use one of
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot the following commands:
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot<LI><CODE>nmake /f Makefile.nt _apacher</CODE> (release build)
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot<LI><CODE>nmake /f Makefile.nt _apached</CODE> (debug build)
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot<P>These will both compile Apache. The latter will include debugging
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot information in the resulting files, making it easier to find bugs and
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot track down problems.</P>
2cacab200fb387e290386593d9b2fca2e7beef33csovant<P>Apache can also be compiled using VC++'s Visual Studio development
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot environment. Although compiling Apache in this manner is not as
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot simple, it makes it possible to easily modify the Apache source, or
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot to compile Apache if the command-line tools are not installed.
2cacab200fb387e290386593d9b2fca2e7beef33csovant Project files (<CODE>.DSP</CODE>) are included for each of the
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot portions of Apache. To build Apache from the these projects files
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot you will need to build the following projects <EM>in this order</EM>:
2cacab200fb387e290386593d9b2fca2e7beef33csovant <LI><CODE>os\win32\ApacheOS.dsp</CODE>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <LI><CODE>regex\regex.dsp</CODE>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <LI><CODE>ap\ap.dsp</CODE>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <LI><CODE>main\gen_uri_delims.dsp</CODE>
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot <LI><CODE>main\gen_test_char.dsp</CODE>
fbf33f9f6dbeb2d7d7c9a7c750eacba87b3ae34dmadiot <LI><CODE>ApacheCore.dsp</CODE>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <LI><CODE>Apache.dsp</CODE>
2cacab200fb387e290386593d9b2fca2e7beef33csovant In addition, the <CODE>src\os\win32</CODE> subdirectory contains
<LI><CODE>nmake /f Makefile.nt installr INSTDIR=<EM>dir</EM></CODE>
<LI><CODE>nmake /f Makefile.nt installd INSTDIR=<EM>dir</EM></CODE>
<LI><CODE><EM>dir</EM>\Apache.exe</CODE> - Apache executable
<LI><CODE><EM>dir</EM>\ApacheCore.dll</CODE> - Main Apache shared library
the conf/magic and conf/mime.types files as well.