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:

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:

  1. regex\regex.dsp
  2. lib\apr\aprlib.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 os\win32 subdirectory contains project files for the optional modules.
  1. os\win32\ApacheModuleAuthAnon.dsp
  2. os\win32\ApacheModuleCERNMeta.dsp
  3. os\win32\ApacheModuleDigest.dsp
  4. os\win32\ApacheModuleExpires.dsp
  5. os\win32\ApacheModuleHeaders.dsp
  6. os\win32\ApacheModuleInfo.dsp
  7. os\win32\ApacheModuleRewrite.dsp
  8. os\win32\ApacheModuleSpeling.dsp
  9. os\win32\ApacheModuleStatus.dsp
  10. os\win32\ApacheModuleUserTrack.dsp
The support\ folder contains project files for additional programs that are not part of the apache runtime, but are used by the administrator to maintain password and log files.

  1. support\htdigest.dsp
  2. support\htpasswd.dsp
  3. support\logresolve.dsp
  4. support\rotatelogs.dsp

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 build and install all the files into the desired folder dir automatically, use one the following nmake commands:

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:

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

To simplify the process, dependencies between all projects are defined in the Microsoft VisualStudio workspace file:

   src/Apache.dsw
This assures that lower-level sources are rebuilt from within VisualStudio. The top level project is InstallBin, which invokes Makefile.win to move the compiled executables and dlls. You may personalize the INSTDIR= setting by changing the Settings for InstallBin, Build command line entry under the General tab. The default from within the InstallBin.dsp project is one level up (..) from the src tree.

Warning about building Apache from the development tree

Only the .dsp files are distributed between release builds. The .mak files are NOT regenerated, due to the tremendous waste of reviewer's time. Therefore, you cannot rely on the NMAKE commands above unless you -frequently- export all .mak files yourself from the project. This is unnecessary if you build from withing the Microsoft DeveloperStudio environment.

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.