windows.html revision 830ba2e70a95c963edf97894e537b9aba72ac065
1c57c3f79db0bf0358bbe6d7b5ad650c0c852f4bTinderbox User<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
1c57c3f79db0bf0358bbe6d7b5ad650c0c852f4bTinderbox User<HTML>
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User<HEAD>
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User<TITLE>Using Apache with Microsoft Windows</TITLE>
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User</HEAD>
1c57c3f79db0bf0358bbe6d7b5ad650c0c852f4bTinderbox User
8c225507766814e78e168b17a24b8a47ca7f8c37Tinderbox User<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
1c57c3f79db0bf0358bbe6d7b5ad650c0c852f4bTinderbox User<BODY
1c57c3f79db0bf0358bbe6d7b5ad650c0c852f4bTinderbox User BGCOLOR="#FFFFFF"
1c57c3f79db0bf0358bbe6d7b5ad650c0c852f4bTinderbox User TEXT="#000000"
1c57c3f79db0bf0358bbe6d7b5ad650c0c852f4bTinderbox User LINK="#0000FF"
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User VLINK="#000080"
1c57c3f79db0bf0358bbe6d7b5ad650c0c852f4bTinderbox User ALINK="#FF0000"
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User>
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User<!--#include virtual="header.html" -->
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
f9ce6280cec79deb16ff6d9807aa493ff23e10d9Tinderbox User<H1 ALIGN="CENTER">Using Apache With Microsoft Windows</H1>
164ade1482251e1da962b42e5bf0d3aa02a11e03Tinderbox User
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User<P>This document explains how to install, configure and run
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User Apache 1.3 under Microsoft Windows. Please note that at
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt this time, Windows support is entirely experimental, and is
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt recommended only for experienced users. The Apache Group does not
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User guarantee that this software will work as documented, or even at
0da02c26a6631c25f075a8e4ac6de9e58f49a0c2Tinderbox User all. If you find any bugs, or wish to contribute in other ways, please
0da02c26a6631c25f075a8e4ac6de9e58f49a0c2Tinderbox User use our <A HREF="http://www.apache.org/bug_report.html">bug reporting
0da02c26a6631c25f075a8e4ac6de9e58f49a0c2Tinderbox User page.</A></P>
0da02c26a6631c25f075a8e4ac6de9e58f49a0c2Tinderbox User
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt<P><STRONG>Warning: Apache on NT has not yet been optimized for performance.
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox UserApache still performs best, and is most reliable on Unix platforms. Over
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Usertime we will improve NT performance. Folks doing comparative reviews
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Userof webserver performance are asked to compare against Apache
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunton a Unix platform such as Solaris, FreeBSD, or Linux.</STRONG></P>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User<P>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox UserMost of this document assumes that you are installing Windows from a
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntbinary distribution. If you want to compile Apache yourself (possibly
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntto help with development, or to track down bugs), see the section on
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt<A HREF="#comp">Compiling Apache for Windows</A> below.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User<HR>
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User<UL>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <LI><A HREF="#req">Requirements</A>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User <LI><A HREF="#down">Downloading Apache for Windows</A>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User <LI><A HREF="#inst">Installing Apache for Windows (binary install)</A>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User <LI><A HREF="#run">Running Apache for Windows</A>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User <LI><A HREF="#use">Using Apache for Windows</A>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User <LI><A HREF="#cmdline">Running Apache for Windows from the Command Line</A>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User <LI><A HREF="#signal">Signalling Apache when running</A>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User <LI><A HREF="#comp">Compiling Apache for Windows</A>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User</UL>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User<HR>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User<H2><A NAME="req">Requirements</A></H2>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox UserApache 1.3 is designed to run on Windows NT 4.0. The binary installer
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox Userwill only work in Intel processors. Apache may also run on Windows 95,
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox UserWindows 98 and Windows NT 3.5.1, but these have not been tested. In
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox Userall cases TCP/IP networking must be installed.
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User<P>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox UserIf running on Windows 95, using the "Winsock2" upgrade is recommended
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox Userbut may not be necessary. If running on NT 4.0, installing Service Pack 2
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox Useris recommended.
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User<H2><A NAME="down">Downloading Apache for Windows</A></H2>
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User<P>Information on the latest version of Apache can be found on the
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox UserApache web server at <A
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox UserHREF="http://www.apache.org/">http://www.apache.org/</A>. This will
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox Userlist the current release, any more recent alpha or beta-test releases,
a1ff871f78b7d907d6fc3a382beea2a640fe8423Tinderbox Usertogether with details of mirror web and anonymous ftp sites.</P>
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
0da02c26a6631c25f075a8e4ac6de9e58f49a0c2Tinderbox User<P>
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User
0da02c26a6631c25f075a8e4ac6de9e58f49a0c2Tinderbox UserYou should download the version of Apache for Windows with the
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User<CODE>.exe</CODE> extension. This is a single file containing Apache,
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Userready to install and run. There may also be a <CODE>.zip</CODE> file
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox Usercontaining the source code, to compile Apache yourself. (If there is
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox Userno <SAMP>.zip</SAMP> file, the source will be available in a
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User<SAMP>.tar.gz</SAMP> file but this will contain Unix line endings. You
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox Userwill have to convert at least the <SAMP>.mak</SAMP> and
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User<SAMP>.dsp</SAMP> files to have DOS line endings before MSVC will
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox Userunderstand them).
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User<H2><A NAME="inst">Installing Apache for Windows</A></H2>
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox UserRun the Apache <SAMP>.exe</SAMP> file you downloaded above. This will
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox Userask for:
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User<UL>
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User <LI>the directory to install Apache into (the default is
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User <CODE>\Program Files\Apache Group\Apache</CODE> although you can
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User change this to any other directory)
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User <LI>the start menu name (default is "Apache Web Server")
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User <LI>the installation type. The "Typical" option installs
a1ff871f78b7d907d6fc3a382beea2a640fe8423Tinderbox User everything except the source code. The "Minimum" option does not
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt install the manuals or source code. Choose the "Custom" install if
164ade1482251e1da962b42e5bf0d3aa02a11e03Tinderbox User you want to install the source code.
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
164ade1482251e1da962b42e5bf0d3aa02a11e03Tinderbox User</UL>
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
164ade1482251e1da962b42e5bf0d3aa02a11e03Tinderbox User<P>
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox UserDuring the installation, Apache will configure the files in the
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User<SAMP>conf</SAMP> directory for your chosen installation
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntdirectory. However if any of the files in this directory already exist
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntthey will <STRONG>not</STRONG> be overwritten. Instead the new copy of
0da02c26a6631c25f075a8e4ac6de9e58f49a0c2Tinderbox Userthe corresponding file will be left with the extension
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User<SAMP>.default</SAMP>. So, for example, if
164ade1482251e1da962b42e5bf0d3aa02a11e03Tinderbox User<SAMP>conf\httpd.conf</SAMP> already exists it will not be altered,
164ade1482251e1da962b42e5bf0d3aa02a11e03Tinderbox Userbut the version which would have been installed will be left in
164ade1482251e1da962b42e5bf0d3aa02a11e03Tinderbox User<SAMP>conf\httpd.conf.default</SAMP>. After the installation has
164ade1482251e1da962b42e5bf0d3aa02a11e03Tinderbox Userfinished you should manually check to see what in new in the
164ade1482251e1da962b42e5bf0d3aa02a11e03Tinderbox User<SAMP>.default</SAMP> file, and if necessary update your existing
164ade1482251e1da962b42e5bf0d3aa02a11e03Tinderbox Userconfiguration files.
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
0da02c26a6631c25f075a8e4ac6de9e58f49a0c2Tinderbox User<P>
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox UserAlso, if you already have a file called <SAMP>htdocs\index.html</SAMP>
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Userthen it will not be overwritten (no <SAMP>index.html.default</SAMP>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntfile will be installed either). This should mean it a safe to install
164ade1482251e1da962b42e5bf0d3aa02a11e03Tinderbox UserApache over an existing installation (but you will have to stop the
ffe29868b4bbc64953fc5d0de51f988c20158967Tinderbox Userexisting server running before doing the installation, then start the
ffe29868b4bbc64953fc5d0de51f988c20158967Tinderbox Usernew one after the installation is finished).
164ade1482251e1da962b42e5bf0d3aa02a11e03Tinderbox User
ffe29868b4bbc64953fc5d0de51f988c20158967Tinderbox User<P>
ffe29868b4bbc64953fc5d0de51f988c20158967Tinderbox User
ffe29868b4bbc64953fc5d0de51f988c20158967Tinderbox UserAfter installing Apache, you should edit the configuration files in
ffe29868b4bbc64953fc5d0de51f988c20158967Tinderbox Userthe <SAMP>conf</SAMP> directory as required. These files will be
ffe29868b4bbc64953fc5d0de51f988c20158967Tinderbox Userconfigured during the install ready for Apache to be run from the
ffe29868b4bbc64953fc5d0de51f988c20158967Tinderbox Userdirectory where it was installed, with the documents served from the
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntsubdirectory <SAMP>htdocs</SAMP>. There are lots of other options
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Userwhich should be set before you start really using Apache. However to
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntget started quickly the files should work as installed.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<H2><A NAME="run">Running Apache for Windows</A></H2>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox UserThere are two ways you can run Apache:
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt<UL>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <LI>As a "service" (available on NT only). This is the best option if
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User you want Apache to automatically start when you machine boots, and to
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User keep Apache running when you log-off.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <LI>From a <A HREF="#cmdline">console window</A>. This is the only option
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt available for
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User Windows 95 users.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt</UL>
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
14a656f94b1fd0ababd84a772228dfa52276ba15Evan HuntTo start Apache as a service, you first need to install it as a
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Userservice. Run the "Install Apache as Service" option from the Start
1c57c3f79db0bf0358bbe6d7b5ad650c0c852f4bTinderbox Usermenu. Once this is done you can start Apache by opening the Services
window (in the Control Panel), selecting Apache, then clicking on
Start. Apache will now be running in the background. You can later
stop Apache by clicking on Stop. As an alternative to using the
Services window, you can start and stop Apache from the control line
with
<PRE>
NET START APACHE
NET STOP APACHE
</PRE>
To run Apache from a console window, select the "Start Apache as
console app" option from the Start menu. This will open a console
window and start Apache running inside it. The window will remain
active until you stop Apache. To stop Apache running, either select
the "Shutdown Apache console app" icon option from the Start menu, or
see <A HREF="#signal"><SAMP>Signalling Apache when Running</SAMP></A>
for how to control Apache from the command line.
<P>
After starting Apache running (either in a console window or as a
service) if will be listening to port 80 (unless you changed the
<SAMP>Port</SAMP>, <SAMP>Listen</SAMP> or <SAMP>BindAddress</SAMP>
directives in the configuration files). To connect to the server and
access the default page, launch a browser and enter this URL:
<PRE>
http://localhost/
</PRE>
This should respond with a welcome page, and a link to the Apache
manual. If nothing happens or you get an error, look in the
<SAMP>error_log</SAMP> file in the <SAMP>logs</SAMP> directory.
<P>
Once your basic installation is working, you should configure it
properly by editing the files in the <SAMP>conf</SAMP> directory.
<H2><A NAME="use">Configuring Apache for Windows</A></H2>
Apache is configured by files in the <SAMP>conf</SAMP>
directory. These are the same as files used to configure the Unix
version, but there are a few different directives for Apache on
Windows. See the <A HREF="./">Apache documentation</A> for all the
available directives.
<P>
The main differences in Apache for Windows are:
<UL>
<LI><P>Because Apache for Windows is multithreaded, it does not use a
separate process for each request, as Apache does with
Unix. Instead there are usually only two Apache processes running:
a parent process, and a child which handles the requests. Within
the child each request is handled by a separate thread.
<P>
So the "process"-management directives are different:
<P><A
HREF="mod/core.html#maxrequestsperchild">MaxRequestsPerChild</A>
- Like the Unix directive, this controls how many requests a
process will serve before exiting. However, unlike Unix, a
process serves all the requests at once, not just one, so if
this is set, it is recommended that a very high number is
used. The recommended default, <CODE>MaxRequestsPerChild
0</CODE>, does not cause the process to ever exit.
<P><A HREF="mod/core.html#threadsperchild">ThreadsPerChild</A> -
This directive is new, and tells the server how many threads it
should use. This is the maximum number of connections the server
can handle at once; be sure and set this number high enough for
your site if you get a lot of hits. The recommended default is
<CODE>ThreadsPerChild 50</CODE>.</P>
<LI><P>The directives that accept filenames as arguments now must use
Windows filenames instead of Unix ones. However, because Apache
uses Unix-style names internally, you must use forward slashes, not
backslashes. Drive letters can be used; if omitted, the drive with
the Apache executable will be assumed.</P>
<LI><P>Apache for Windows contains the ability to load modules at runtime,
without recompiling the server. If Apache is compiled normally, it
will install a number of optional modules in the
<CODE>\Apache\modules</CODE> directory. To activate these, or other
modules, the new <A HREF="mod/mod_so.html#loadmodule">LoadModule</A>
directive must be used. For example, to active the status module,
use the following (in addition to the status-activating directives
in <CODE>access.conf</CODE>):</P>
<PRE>
LoadModule status_module modules/ApacheModuleStatus.dll
</PRE>
<P>Information on <A HREF="mod/mod_so.html#creating">creating loadable
modules</A> is also available.</P>
<LI><P>Apache can also load ISAPI Extensions (<EM>i.e.</EM>, Internet Server
Applications), such as those used by Microsoft's IIS, and other
Windows servers. <A HREF="mod/mod_isapi.html">More information
is available.</A>
</UL>
<H2><A NAME="cmdline">Running Apache for Windows from the Command Line</A></H2>
The Start menu icons and the NT Service manager can provide a simple
interface for administering Apache. But in some cases it is easier to
work from the command line.
<P>
When working with Apache it is important to know how it will find the
configuration files. Apache will try one of the following, in this order.
<UL>
<LI>A ServerRoot directive via a -C switch.
<LI>The -f switch on the command line.
<LI>The -d switch on the command line.
<LI>A registry entry, created if you did a binary install.
<LI>The server root compiled into the server.
</UL>
<P>
The server root compiled into the server is usually "/apache".
invoking apache with the -v switch will display this value
labeled as HTTPD_ROOT.
<P>
Your current working directory when Apache is started up has no
effect on Apache's behavior.
<P>
When invoked from the start menu or the Service Manager, Apache is
usually passed no arguments, so using the registry entry is the preferred
technique.
<P>
During a binary installation, a registry key will have
been installed, for example:
<PRE>
HKEY_LOCAL_MACHINE\Software\Apache Group\Apache\1.3.4\ServerRoot
</PRE>
<P>
This key is compiled into the server and can enable you to test
new versions without affecting the current version. Of course
you must take care not to install the new version on top of the
old version in the file system. You cannot run two invocations
of Apache on Windows simultaneously.
<P>
If you did not do a binary install then Apache will in some
scenarios complain that about the missing registry key. This
warning can be ignored if it otherwise was able to find it's
configuration files.
<P>
The value of this key is the "ServerRoot" directory, containing the
<SAMP>conf</SAMP> directory. When Apache starts it will read the
<SAMP>httpd.conf</SAMP> file from this directory. If this file
contains a <SAMP>ServerRoot</SAMP> directive which is different from
the directory obtained from the registry key above, Apache will forget
the registry key and use the directory from the configuration file.
If you copy the Apache directory or configuration files to a new
location it is vital that you update the <SAMP>ServerRoot</SAMP>
directory in the <SAMP>httpd.conf</SAMP> file to the new location.
<P>
To run Apache from the command line as a console application, use the
following command:
<PRE>
apache -s
</PRE>
Apache will execute, and will remain running until it is stopped by pressing
control-C. (The -s option is not required by Windows 95, but on Windows NT it
prevents Apache waiting to see if Apache is running as a service.)
<P>
You can install Apache as a Windows NT service as follows:
<PRE>
apache -i
</PRE>
and to remove the Apache service, use
<PRE>
apache -u
</PRE>
<H2><A NAME="signal">Signalling Apache when running</A></H2>
On Windows 95, Apache runs as a console application. You can tell a
running Apache to stop by opening another console window and running
<PRE>
apache -k shutdown
</PRE>
<BLOCKQUOTE>
<STRONG>Note: This option is only available with Apache 1.3.3 and
later. For earlier versions, you need to use Control-C in the
Apache console window to shut down the server.</STRONG>
</BLOCKQUOTE>
<P>
This should be used instead of pressing Control-C in the running
Apache console window, because it lets Apache end any current
transactions and cleanup gracefully.
<P>
You can also tell Apache to restart. This makes it re-read the
configuration files. Any transactions in progress are allowed to
complete without interruption. To restart Apache, run
<PRE>
apache -k restart
</PRE>
<BLOCKQUOTE>
<STRONG>Note: This option is only available with Apache 1.3.3 and
later. For earlier versions, you need to use Control-C in the
Apache console window to shut down the server.</STRONG>
</BLOCKQUOTE>
<P>
Note for people familiar with the Unix version of Apache: these
commands provide a Windows equivalent to <CODE>kill -TERM
<EM>pid</EM></CODE> and <CODE>kill -USR1 <EM>pid</EM></CODE>. The command
line option used, <CODE>-k</CODE>, was chosen as a reminder of the
"kill" command used on Unix.
<H2><A NAME="comp">Compiling Apache for Windows</A></H2>
<P>Compiling Apache requires Microsoft Visual C++ 5.0 to be properly
installed. It is easiest to compile with the command-line tools
(nmake, <EM>etc.</EM>..). Consult the VC++ manual to determine how to install
them.</P>
<P>First, unpack the Apache distribution into an appropriate
directory. Open a command-line prompt, and change to the
<CODE>src</CODE> subdirectory of the Apache distribution.</P>
<P>The master Apache makefile instructions are contained in the
<CODE>Makefile.nt</CODE> file. To compile Apache on Windows NT, simply
use one of the following commands:
<UL>
<LI><CODE>nmake /f Makefile.nt _apacher</CODE> (release build)
<LI><CODE>nmake /f Makefile.nt _apached</CODE> (debug build)
</UL>
<P><em>(1.3.4 and later)</em> To compile Apache on Windows 95, use one of
<UL>
<LI><CODE>nmake /f Makefile_win32.txt</CODE> (release build)
<LI><CODE>nmake /f Makefile_win32_debug.txt</CODE> (debug build)
</UL>
<P>These will both compile Apache. The latter will include debugging
information in the resulting files, making it easier to find bugs and
track down problems.</P>
<P>Apache can also be compiled using VC++'s Visual Studio development
environment. Although compiling Apache in this manner is not as
simple, it makes it possible to easily modify the Apache source, or
to compile Apache if the command-line tools are not installed.
Project files (<CODE>.DSP</CODE>) are included for each of the
portions of Apache. To build Apache from the these projects files
you will need to build the following projects <EM>in this order</EM>:
<OL>
<LI><CODE>os\win32\ApacheOS.dsp</CODE>
<LI><CODE>regex\regex.dsp</CODE>
<LI><CODE>ap\ap.dsp</CODE>
<LI><CODE>main\gen_uri_delims.dsp</CODE>
<LI><CODE>main\gen_test_char.dsp</CODE>
<LI><CODE>ApacheCore.dsp</CODE>
<LI><CODE>Apache.dsp</CODE>
</OL>
In addition, the <CODE>src\os\win32</CODE> subdirectory contains
project files for the optional modules (see below).</P>
<P>Once Apache has been compiled, it needs to be installed in its server
root directory. The default is the <CODE>\Apache</CODE>
directory, on the current hard drive. </P>
<P>To install the files into the <CODE>\Apache</CODE> directory
automatically, use one the following nmake commands (see above):</P>
<UL>
<LI><CODE>nmake /f Makefile.nt installr INSTDIR=<EM>dir</EM></CODE>
(for release build)
<LI><CODE>nmake /f Makefile.nt installd INSTDIR=<EM>dir</EM></CODE>
(for debug build)
</UL>
or, for Windows 95 (1.3.4 and later), use one of:
<UL>
<LI><CODE>nmake /f Makefile_win32.txt install INSTDIR=<EM>dir</EM></CODE>
(for release build)
<LI><CODE>nmake /f Makefile_win32_debug.txt install INSTDIR=<EM>dir</EM></CODE>
(for debug build)
</UL>
The dir argument to INSTDIR gives the installation directory; it can
be omitted if Apache is to be installed into <SAMP>\Apache</SAMP>.
<P>This will install the following:</P>
<UL>
<LI><CODE><EM>dir</EM>\Apache.exe</CODE> - Apache executable
<LI><CODE><EM>dir</EM>\ApacheCore.dll</CODE> - Main Apache shared library
<LI><CODE><EM>dir</EM>\modules\ApacheModule*.dll</CODE> - Optional Apache
modules (7 files)
<LI><CODE><EM>dir</EM>\conf</CODE> - Empty configuration directory
<LI><CODE><EM>dir</EM>\logs</CODE> - Empty logging directory
</UL>
<P>If you do not have nmake, or wish to install in a different directory,
be sure to use a similar naming scheme.</P>
<P>
Before running the server you must fill out the conf directory.
Copy the *.conf-dist-win from the distribution conf directory
and rename *.conf. Edit the @@ServerRoot@@ entries to your
actual server root (for example "C:\apache"). Copy over
the conf/magic and conf/mime.types files as well.
<!--#include virtual="footer.html" -->
</BODY>
</HTML>