Using Apache with Microsoft Windows

# Compiling Apache for Microsoft Windows

There are many important points before you begin compiling Apache. See Using Apache with Microsoft Windows before you begin.

Compiling Apache requires Microsoft Visual C++ 5.0 (or later) 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.

First, unpack the Apache distribution into an appropriate directory. Open a command-line prompt, and change to the `src` subdirectory of the Apache distribution.

The master Apache makefile instructions are contained in the `Makefile.win` file. To compile Apache on Windows, simply use one of the following commands:

- `nmake /f Makefile.win _apacher` (release build)
- `nmake /f Makefile.win _apached` (debug build)

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.

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 (`.DSP`) 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 in this order: This needs updating for Apache 2.0

1. `os\win32\ApacheOS.dsp`
2. `regex\regex.dsp`
3. `ap\ap.dsp`
4. `main\gen_uri_delims.dsp`
5. `main\gen_test_char.dsp`
6. `ApacheCore.dsp`
7. `Apache.dsp`

In addition, the `src\os\win32` subdirectory contains project files for the optional modules (see below).

Once Apache has been compiled, it needs to be installed in its server root directory. The default is the `\Apache` directory, on the current hard drive.

To install the files into the `\Apache` directory automatically, use one the following nmake commands (see above):

- `nmake /f Makefile.win installr INSTDIR=dir` (for release build)
- `nmake /f Makefile.win installd INSTDIR=dir` (for debug build)

The dir argument to INSTDIR gives the installation directory; it can be omitted if Apache is to be installed into `\Apache`.

This will install the following:

- `dir\Apache.exe` - Apache executable
- `dir\ApacheCore.dll` - Main Apache shared library
- `dir\modules\ApacheModule*.dll` - Optional Apache modules (7 files)
- `dir\conf` - Empty configuration directory
- `dir\logs` - Empty logging directory

If you do not have nmake, or wish to install in a different directory, be sure to use a similar naming scheme.

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.