A new release of Apache web server is available for download. This article covers the compiling the new release on the win32 platform with SSL. Most Apache2 packages don't come with mod_ssl compiled, and that is the main reason why we are making the effort to make it available. And in case you are inclined to build it yourself, we have provided you some build notes and instructions on making Apache 2.0.55 w/ mod_ssl and mod_deflate support.


My Configuration

  • Install to : C:\www\apache2
  • System:Port : localhost:80
  • Module Type : dynamically loaded modules, *.so
  • Additional modules : mod_ssl, mod_deflate
  • Perl.exe path : C:\perl\bin\perl.exe
  • Other tools path : c:\cygwin\bin path to other tools (awk, bison, flex, and sed)

Setting the Environment

Since I used the Visual C++ from the command line to build the tools, the environment has to be set properly. In the build DOS command shell window, locate and execute the vcvars32.bat file. On my system this file is located: C:\Program Files\Microsoft Visual Studio\VC98\Bin. The build process for mod_ssl needs to be able to find the ml.exe that is part of the MASM package. Make sure you include C:\masm32\bin to the global environment PATH variable.


Download all the source packages. Unpack the httpd-2.0.55-win32-src.zip package to C:\src. Unpack openssl-0.9.8a.tar.gz to C:\src\httpd-2.0.55\srclib\openssl. Unpack the zlib114.zip to C:\src\httpd-2.0.55\srclib\zlib.

NOTE: you should delete the symlink 'awk.exe' and rename 'gawk.exe' to 'awk.exe' in the C:\cygwin\bin directory.

Setup for mod_deflate

The apache build process will automatically buid the mod_deflate module if it detects the zlib source code in the srclib directory. The zlib source code must be placed in the httpd-2.0.55\srclib dir as (httpd-2.0.55\srclib\zlib).

NOTE: you must build with zlib-1.1.4 and not zlib-1.2.3, otherwise, mod_deflate will fail during the build.

Setup for mod_ssl

To build mod_ssl, the OpenSSL source code directory needs to be placed under httpd-2.0.55\srclib as (httpd-2.0.55\srclib\openssl). The OpenSSL source is then manually compiled, to prepare for the main Apache 2.0 build process.

..\httpd-2.0.55\srclib\openssl > perl Configure --openssldir=C:/www/apache2/bin VC-WIN32
..\httpd-2.0.55\srclib\openssl > ms\do_masm
..\httpd-2.0.55\srclib\openssl > nmake -f ms\ntdll.make

[Optional] To test the built OpenSSL package:

..\httpd-2.0.55\srclib\openssl > cd out32dll
..\httpd-2.0.55\srclib\openssl\out32dll > ..\ms\test

Build/Install Apache

This next section covers the building of the apache 2.0.55 source. Build the source using the following command:

nmake /f Makefile.win SERVERNAM="localhost" PORT=80 INSTDIR="C:\www\apache2" installr

The following is a list of make or build targets that have been configured in the Makefile.win:

# Makefile for Windows NT and Windows 95/98/2000

# Targets are:
# _apacher - build Apache in Release mode
# _apached - build Apache in Debug mode
# installr - build and install a Release build
# installd - build and install a Debug build
# clean - remove (most) generated files
# _cleanr - remove (most) files generated by a Release build
# _cleand - remove (most) files generated by a Debug build
# _browse - build the browse info file
# The following install defaults may be customized;
# Option Default
# INSTDIR \Apache2
# PORT 80
# SERVERNAME localhost
# For example;
# nmake /f Makefile.win PORT=80 INSTDIR="d:\Program Files\Apache" installr

Additional Steps

During the Apache 2.0 build process, the needed OpenSSL files (libeay32.dll, ssleay32.dll, and openssl.exe) are placed into ..\apache2\bin, except openssl.cnf. The openssl.cnf is the OpenSSL configuration file and needs to be copied manually.

..\httpd-2.0.55\srclib\openssl> copy apps\openssl.cnf C:\www\apache2\bin

SSL Private/Public Key Setup

mkdir C:\www\apache2\conf\ssl.cnf
mkdir C:\www\apache2\conf\ssl.key
cd \www\apache2\conf

next, create a certificate signing request (server.csr) and private key (privkey.pem)

openssl req -new -out server.csr

The following command then removes the pass-phrase from the private key (privkey.pem), creating server.key

openssl rsa -in privkey.pem -out server.key

Lastly, create a self-signed certificate, server.crt(public key) and copy it into place

openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365
move server.crt ssl.crt
move server.key ssl.key
del .rnd
del privkey.pem
del server.csr

Update httpd.conf Configuration

Configure the httpd.conf file in the ..\apache2\conf directory with the following:

  • Add LoadModule deflate_module modules/mod_deflate.so at the end of the modules list
  • Uncomment LoadModule headers_module modules/mod_headers.so (required for mod_deflate to support requests that come from behind proxies)
  • Add AddOutputFilterByType DEFLATE text/html text/plain text/css in to the <Directory /> block to compress txt, html and css
  • Add Header append Vary User-Agent into the <Directory /> block (required for mod_deflate to properly handle requests coming from proxies)
  • Add BrowserMatch ^Mozilla/4 gzip-only-text/html
  • Add BrowserMatch ^Mozilla/4\.0[678] no-gzip
  • Add BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  • Uncomment LoadModule ssl_module modules/mod_ssl.so

Startup and Operation

Install the 'Apache2' web server as a service with the following command:

C:\www\apache2\bin> apache -D SSL -k install

Start the 'Apache2' web server service

C:\www\apache2\bin> apache -k start


net start apache2

Additional commands:

To stop the apache web server service:

c:\www\apache2\bin> apache -k stop


net stop apache2

To gracefully restart the web:

c:\www\apache2\bin> apache -k restart

To uninstall the 'Apache2' web service from the WIN32 SCM:

c:\www\apache2\bin> apache -k uninstall


To test the regular (port 80) server enter the url: http://localhost
To test the SSL (port 443) server enter the url: https://localhost
Download the precompiled version of Apache 2.0.55 w/ SSL (coming)