Apache HTTP Server Version 2.2
There are many important points before you begin compiling Apache. See Using Apache with Microsoft Windows before you begin.
Compiling Apache requires the following environment to be properly installed:
Make sure you have at least 180 MB of free disk space available. After installation Apache requires approximately 70 MB of disk space, plus space for log and cache files, which can grow rapidly. The actual disk space requirements will vary considerably based on your chosen configuration and any third-party modules or libraries, especially when OpenSSL is also built. Because many files are text and very easily compressed, NTFS filesystem compression cuts these requirements in half.
Microsoft Visual C++ (Microsoft Visual Studio) 6.0 or higher.
Apache can be built using the command line tools, or from
within the Visual Studio IDE Workbench. The command line
build requires the environment to reflect the
LIB and other variables
that can be configured with the
"c:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32"
The Windows Platform SDK for Visual C++ 6.0 (97) or 7.0 (.NET)
Apache's APR and APR-util builds require an updated Microsoft
Windows Platform SDK, from Feb 2003 or later, included in the
Visual C++ 7.1 (Studio 2003) and later. For command line builds with
Visual C++ 6.0 or 7.0, the Platform SDK environment is prepared by
"c:\Program Files\Platform SDK\setenv.bat"
The Platform SDK files distributed with Visual C++ 6.0 and Visual Studio .NET (2000) are no longer sufficient and cause many compilation warnings and linkage errors. Users of Visual C++ 7.1 (Studio 2003) and later versions (of the full product, not the 'Visual Studio Express' flavor) may skip this requirement.
If using the GUI, either start msdev or devenv with the /setenv flag (after invoking setenv.bat), or ensure the paths are correct under the Tools -> Options -> (Projects ->) Directories menu option. The Platform SDK installer will generally help you configure this.
The awk utility (awk, gawk or similar).
To install Apache within the build system, several files are
modified using the
awk.exe utility. awk was chosen since
it is a very small download (compared with Perl or WSH/VB) and
accomplishes the task of modifying configuration files upon
installation. Brian Kernighan's
site has a compiled native Win32 binary,
you must save with the name
awk.exe rather than
Note that Developer Studio IDE will only find
awk.exe from the Executable path specified in the menu
option Tools -> Options -> (Projects ->) Directories.
Add the path for
awk.exe to this list, and your
PATH environment variable, as needed.
gawk.exeand that the file
awk.exeis really a symlink to the
gawk.exefile. The Windows command shell does not recognize symlinks, and because of this building InstallBin will fail. A workaround is to delete
awk.exefrom the cygwin installation and copy
awk.exe. Also note the cygwin/mingw ports of gawk 3.0.x were buggy, please upgrade to 3.1.x before attempting to use any gawk port.
[Optional] zlib library (for
Zlib must be installed into a
srclib subdirectory named
zlib. This must be built in-place. Zlib can be obtained
from http://www.zlib.net/ -- the
mod_deflate is confirmed to work correctly with
nmake -f win32\Makefile.msc
nmake -f win32\Makefile.msc test
[Optional] OpenSSL libraries (for
ab.exe with ssl support)
Caution: there are significant restrictions and prohibitions on the use and distribution of strong cryptography and patented intellectual property throughout the world. OpenSSL includes strong cryptography controlled by both export regulations and domestic law, as well as intellectual property protected by patent, in the United States and elsewhere. Neither the Apache Software Foundation nor the OpenSSL project can provide legal advise regarding possession, use, or distribution of the code provided by the OpenSSL project. Consult your own legal counsel, you are responsible for your own actions.
OpenSSL must be installed into a
openssl, obtained from
http://www.openssl.org/source/, in order to compile
mod_ssl or the abs project (
enabled with SSL support.) To prepare OpenSSL for both
debug builds of Apache, and
disable the patent protected features in OpenSSL, you might use
the following build commands:
perl Configure no-mdc2 no-rc5 no-idea enable-zlib VC-WIN32 -Ipath/to/srclib/zlib
nmake -f ms\ntdll.mak
Note: It is not advisable to use zlib-dynamic, as that could pose a thread race condition. If building zlib on win32, be sure to adjust the resulting ms\ntdll.mak file to link to the full path of srclib\zlib\zdll.lib rather than zlib1.lib (that error in configuration of OpenSSL through 0.9.8h and earlier reflects older zlib 1.1 versions.)
First, unpack the Apache distribution into an appropriate
directory. Open a command-line prompt and
cd to that
The master Apache makefile instructions are contained in the
Makefile.win file. To compile Apache on Windows
NT, simply use one of the following commands to compiled the
debug build, respectively:
nmake /f Makefile.win _apacher nmake /f Makefile.win _apached
Either command will compile Apache. The latter will disable optimization of the resulting files, making it easier to single step the code to find bugs and track down problems.
You can add your apr-util dbd provider choices with the additional make variable DBD_LIST, e.g. DBD_LIST="mysql oracle pgsql sqlite3" to build these four providers. However it's necessary to have the include headers in the INCLUDE path list, db client libraries in the LIB path list, and the db client dll files in the PATH. The specifics for each provider are an exercise left to the reader.
Apache can also be compiled using VC++'s Visual Studio
development environment. To simplify this process, a
Visual Studio workspace,
Apache.dsw, is provided.
This workspace exposes the entire list of working
projects that are required for the complete Apache binary release.
It includes dependencies between the projects to assure that they
are built in the appropriate order.
Apache.dsw workspace, and select
as desired) as the Active Project.
InstallBin causes all
related project to be built, and then invokes
move the compiled executables and dlls. You may personalize the
INSTDIR= choice by changing
General tab, Build command line entry.
INSTDIR defaults to the
/Apache2 directory. If you only want a test compile (without
installing) you may build the
BuildBin project instead.
.dsp project files are distributed in Visual
C++ 6.0 format. Visual C++ 5.0 (97) will recognize them. Visual C++
7.0 (.net) must convert
Apache.dsw plus the
files into an
be sure you reconvert the
.msproj file if any of the source
.dsp files change! This is really trivial, just open
Apache.dsw in the VC++ 7.0 IDE once again.
perl srclib\apr\build\cvtdsp.pl -2005
Visual C++ 7.0 (.net) users should also use the Build
menu, Configuration Manager dialog to uncheck both the
Release Solution modules abs,
These modules are built by invoking
nmake or the IDE directly
BinBuild target to build those modules conditionally
.mak files pose a greater hassle, but they are
required for Visual C++ 5.0 users to build
ab with SSL support) and/or
mod_deflate. VC++ 7.0 (Visual Studio .NET) users
nmake builds were faster than
binenv builds until the parallel compilation features
introduced in Visual Studio 2005. Build the entire project from within
the VC++ 5.0 or 6.0 IDE, preferably with mod_deflate, mod_ssl and abs,
then use the Project Menu Export for all makefiles (preferably, with
dependencies.) You must build the projects first in order to create
all dynamic auto-generated targets, so that dependencies can be parsed
correctly. Run the following command to fix the paths so they will build
You must type this command from the top level
directory of the httpd source tree. Every
.dep project file within
the current directory and below will be corrected, and the
timestamps adjusted to reflect the
If you contribute back a patch that revises project files, we must commit project files in Visual Studio 6.0 format. Changes should be simple, with minimal compilation and linkage flags that will be recognized by all VC++ 5.0 through 7.0 environments.
Apache.dsw workspace and
nmake script both build the
of the Apache server in the following sequence:
In addition, the
modules\ subdirectory tree contains
project files for the majority of the modules.
support\ directory contains project files for
additional programs that are not part of the Apache runtime,
but are used by the administrator to test Apache and maintain
password and log files. Windows-specific support projects are
broken out in the
Once Apache has been compiled, it needs to be installed in
its server root directory. The default is the
\Apache2 directory, of the same drive.
To build and install all the files into the desired folder
dir automatically, use one of the following
nmake /f Makefile.win installr INSTDIR=dir nmake /f Makefile.win installd INSTDIR=dir
The dir argument to
the installation directory; it can be omitted if Apache is
to be installed into
This will install the following:
dir\bin\httpd.exe- Apache executable
dir\bin\ApacheMonitor.exe- Service monitor taskbar icon utility
dir\bin\htdigest.exe- Digest auth password file utility
dir\bin\htdbm.exe- SDBM auth database password file utility
dir\bin\htpasswd.exe- Basic auth password file utility
dir\bin\logresolve.exe- Log file dns name lookup utility
dir\bin\rotatelogs.exe- Log file cycling utility
dir\bin\wintty.exe- Console window utility
dir\bin\libapr.dll- Apache Portable Runtime shared library
dir\bin\libaprutil.dll- Apache Utility Runtime shared library
dir\bin\libhttpd.dll- Apache Core library
dir\modules\mod_*.so- Loadable Apache modules
dir\conf- Configuration directory
dir\logs- Empty logging directory
dir\include- C language header files
dir\lib- Link library files
.dspfiles are maintained between
.makfiles are NOT regenerated, due to the tremendous waste of reviewer's time. Therefore, you cannot rely on the
NMAKEcommands above to build revised
.dspproject files unless you then export all
.makfiles yourself from the project. This is unnecessary if you build from within the Microsoft Developer Studio environment.
BuildBintarget project (or the command line
_apachedtarget) prior to exporting the make files. Many files are autogenerated in the build process. Only a full build provides all of the dependent files required to build proper dependency trees for correct build behavior.
In order to create distribution
.mak files, always
review the generated
dependencies for Platform SDK or other garbage, machine specific
DevStudio\SharedIDE\bin\ (VC5) or
DevStudio\Common\MSDev98\bin\ (VC6) directory contains
sysincl.dat file, which must list all exceptions.
Update this file (including both forward and backslashed paths, such
sys\time.h) to ignore
such dependencies. Including local-install paths in a distributed
.mak file will cause the build to fail completely. And
don't forget to run
order to fix absolute paths within the