1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Using Apache with Microsoft Windows</TITLE>
</HEAD>
<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
<BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#000080"
ALINK="#FF0000"
>
<DIV ALIGN="CENTER">
<IMG SRC="images/sub.gif" ALT="[APACHE DOCUMENTATION]">
<H3>
Apache HTTP Server Version 1.3
</H3>
</DIV>
<H1 ALIGN="CENTER">Using Apache With Microsoft Windows</H1>
<P>This document explains how to install, configure and run
Apache 1.3b6 and later under Microsoft Windows. Please note that at
this time, Windows support is entirely experimental, and is
recommended only for experienced users. The Apache Group does not
guarantee that this software will work as documented, or even at
all. If you find any bugs, or wish to contribute in other ways, please
use our <A HREF="http://www.apache.org/bug_report.html">bug reporting
page.</A></P>
<P><STRONG>Warning: Apache on NT has not yet been optimized for performance.
Apache still performs best, and is most reliable on Unix platforms. Over
time we will improve NT performance. Folks doing comparative reviews
of webserver performance are asked to compare against Apache
on a Unix platform such as Solaris, FreeBSD, or Linux.</STRONG></P>
<P>
Most of this document assumes that you are installing Windows from a
binary distribution. If you want to compile Apache yourself (possibly
to help with development, or to track down bugs), see the section on
<A HREF="#comp">Compiling Apache for Windows</A> below.
<HR>
<UL>
<LI><A HREF="#req">Requirements</A>
<LI><A HREF="#down">Downloading Apache for Windows</A>
<LI><A HREF="#inst">Installing Apache for Windows (binary install)</A>
<LI><A HREF="#run">Running Apache for Windows</A>
<LI><A HREF="#use">Using Apache for Windows</A>
<LI><A HREF="#cmdline">Running Apache for Windows from the Command Line</A>
<LI><A HREF="#comp">Compiling Apache for Windows</A>
</UL>
<HR>
<H2><A NAME="req">Requirements</A></H2>
Apache 1.3 is designed to run on Windows NT 4.0. The binary installer
will only work in Intel processors. Apache may also run on Windows 95
and Windows NT 3.5.1, but these have not been tested. In all cases
TCP/IP networking must be installed.
<P>
If running on Windows 95, using the "Winsock2" upgrade is recommended
but may not be necessary. If running on NT 4.0, installing Service Pack 2
is recommended.
<H2><A NAME="down">Downloading Apache for Windows</A></H2>
<P>Information on the latest version of Apache can be found on the
Apache web server at <A
HREF="http://www.apache.org/">http://www.apache.org/</A>. This will
list the current release, any more recent alpha or beta-test releases,
together with details of mirror web and anonymous ftp sites.</P>
<P>
You should download the version of Apache for Windows with the
<CODE>.exe</CODE> extension. This is a single file containing Apache,
ready to install and run. There may also be a <CODE>.zip</CODE> file
containing the source code, to compile Apache yourself. (If there is
no <SAMP>.zip</SAMP> file, the source will be available in a
<SAMP>.tar.gz</SAMP> file but this will contain Unix line endings. You
will have to convert at least the <SAMP>.mak</SAMP> and
<SAMP>.dsp</SAMP> files to have DOS line endings before MSVC will
understand them).
<H2><A NAME="inst">Installing Apache for Windows</A></H2>
Run the Apache <SAMP>.exe</SAMP> file you downloaded above. This will
ask for:
<UL>
<LI>the directory to install Apache into (the default is
<CODE>\Program Files\Apache Group\Apache</CODE> although you can
change this to any other directory)
<LI>the start menu name (default is "Apache Web Server")
<LI>the installation type. The "Typical" option installs
everything except the source code. The "Minimum" option does not
install the manuals or source code. Choose the "Custom" install if
you want to install the source code.
</UL>
<P>
During the installation, Apache will configure the files in the
<SAMP>conf</SAMP> directory for your chosen installation
directory. However if any of the files in this directory already exist
they will <STRONG>not</STRONG> be overwritten. Instead the new copy of
the corresponding file will be left with the extension
<SAMP>.default</SAMP>. So, for example, if
<SAMP>conf\httpd.conf</SAMP> already exists it will not be altered,
but the version which would have been installed will be left in
<SAMP>conf\httpd.conf.default</SAMP>. After the installation has
finished you should manually check to see what in new in the
<SAMP>.default</SAMP> file, and if necessary update your existing
configuration files.
<P>
Also, if you already have a file called <SAMP>htdocs\index.html</SAMP>
then it will not be overwritten (no <SAMP>index.html.default</SAMP>
file will be installed either). This should mean it a safe to install
Apache over an existing installation (but you will have to stop the
existing server running before doing the installation, then start the
new one after the installation is finished).
<P>
<BLOCKQUOTE>
<STRONG>Important note for 1.3b6 installs</STRONG>: the above only
applies for 1.3b7 and later. In 1.3b6 the installer would overwrite
any existing <SAMP>httpd.conf</SAMP>, <SAMP>access.conf</SAMP>,
<SAMP>srm.conf</SAMP> or <SAMP>mime.types</SAMP> files in the
<SAMP>conf</SAMP>, and will also overwrite your
<SAMP>index.html</SAMP> file in the <SAMP>htdocs</SAMP> directory. You
should copy these files or directories before installing Apache 1.3b6
or install into a new directory.
</BLOCKQUOTE>
<P>
After installing Apache, you should edit the configuration files in
the <SAMP>conf</SAMP> directory as required. These files will be
configured during the install ready for Apache to be run from the
directory where it was installed, with the documents served from the
subdirectory <SAMP>htdocs</SAMP>. There are lots of other options
which should be set before you start really using Apache. However to
get started quickly the files should work as installed.
<H2><A NAME="inst">Running Apache for Windows</A></H2>
There are two ways you can run Apache:
<UL>
<LI>As a "service" (available on NT only). This is the best option if
you want Apache to automatically start when you machine boots, and to
keep Apache running when you log-off.
<LI>From a console window. This is the only option available for
Windows 95 users.
</UL>
To start Apache as a service, you first need to install it as a
service. Run the "Install Apache as Service" option from the Start
menu. 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 "Apache Server" 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, press Control-C within the console
window.
<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 (i.e., 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 an simple
interafce 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. During installation, a registry key will have
been installed. For the 1.3 beta releases the key is:
<PRE>
HKEY_LOCAL_MACHINE\Software\Apache Group\Apache\1.3 beta\ServerRoot
</PRE>
While for the final 1.3.0 release it is called:
<PRE>
HKEY_LOCAL_MACHINE\Software\Apache Group\Apache\1.3.0\ServerRoot
</PRE>
(The use of different keys lets you install later versions without
affect any previous versions already installed. For example, when
1.3.1 comes out it will use "1.3.1" instead of "1.3.0" in the registry
key, so you can install and test 1.3.1 without affecting you existing
1.3.0 installation. Note however that Windows NT service manager only
ever allows one service with the same name, so you cannot install the
newer version as a service whilst the older version is still
installed).
<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>
(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). Apache will execute, and will remain running until it
is stopped by pressing control-C.
<P>
To install Apache as a Windows NT service, use the following:
<PRE>
apache -i
</PRE>
and to remove the Apache service, use
<PRE>
apache -u
</PRE>
If you want to run an installation of Apache in a directory other than
the one in the registry key as above, use the <CODE>-f</CODE>
command-line to specify the path to the <SAMP>httpd.conf</SAMP> file,
or the <CODE>-d</CODE> option to specify the server root
directory. These options can be used with any of the other flags as
listed above. Again note that once Apache has read the
<SAMP>httpd.conf</SAMP> file it will then start using the directory
given on the <SAMP>ServerRoot</SAMP> directive line instead of the -f
or -d command line argument.
<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, etc...). 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, 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>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.</P>
<P>Project files (<CODE>.DSP</CODE>) are included for each of the
portions of Apache. The three projects that are necessary for
Apache to run are <CODE>Apache.dsp</CODE>, <CODE>ap/ap.dsp</CODE>,
<CODE>regex/regex.dsp</CODE>, <CODE>ApacheCore.dsp</CODE> and
<CODE>os/win32/ApacheOS.dsp</CODE>. The <CODE>src/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>
The dir argument to INSTDIR gives the installation directory. The 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>
<HR>
<H3 ALIGN="CENTER">
Apache HTTP Server Version 1.3
</H3>
<A HREF="./"><IMG SRC="images/index.gif" ALT="Index"></A>
</BODY>
</HTML>
|