The Apache + SSL on Win32 HOWTO

Version 1.2.5


This page describes the installation of the Win32 version of Apache with the mod_ssl extension. The newest version should always be available from
This process worked on Windows NT and Windows 98; please mail me your suggestions and bug reports.
You can even install Apache with SSL in addition to the Microsoft Internet Information Server if you need to.

Apache with mod_ssl seems to be the only free (as in speech, not in beer) solution for Win32. Please note that Apache on Win32 is considered beta quality as it doesn't reach the stability and performance of Apache on Un*x platforms.

Microsoft IIS doesn't cost money either, and it has SSL, too. However, exported versions of it are only able to use 40-bit cryptography which is considered quite insecure. OpenSSL uses 128 bit that is much more secure. The other problem with IIS is that it doesn't seem to accept self-signed certificates which are quite useful for testing purposes and intranet servers.

1.: Install Apache

Get the Win32 version of the Apache web server from one of the mirrors. It is called something like apache_x_y_z_win32.exe. This is a self-extracting archive that contains the Apache base system and sample configuration files.

Install Apache as described in

Change at least the following parameters in Apache-dir/conf/httpd.conf:
[Replace all occurences of with the real domain name!]

Install the Apache service (NT only) and start the server. Verify that everything works before proceeding to the SSL installation because this limits the possible errors.

Try It won't be encrypted yet but if this works then the port configuration (port 443) is right.

2.: Get OpenSSL and mod_ssl

Go to and find a file called like Download and unzip it to a new directory.

Copy the files ssleay32.dll and libeay32.dll from the Apache directory to WINNT\System32.

You'll need a config file for OpenSSL.exe. Here is one. Copy it to the directory openssl.exe is in.

3.: Create a test certificate

The following instructions are from

openssl req -new > my-server.csr -config openssl.cnf
This creates a certificate signing request and a private key. When asked for "Common Name (eg, your websites domain name)", give the exact name of your web server (e.g. The certificate belongs to this server name and browsers complain if the name doesn't match.

openssl rsa -in privkey.pem -out my-server.key -config openssl.cnf
This removes the passphrase from the private key. You MUST understand what this means; my-server.key should be only readable by the apache server and the administrator.
You should delete the .rnd file because it contains the entropy information for creating the key and could be used for cryptographical attacks against your private key.

openssl x509 -in my-server.csr -out my-server.cert -req -signkey my-server.key -days 365 -config openssl.cnf
This creates a self-signed certificate that you can use until you get a "real" one from a certificate authority. (Which is optional; if you know your users, you can tell them to install the certificate into their browsers.) Note that this certificate expires after one year, you can increase -days 365 if this isn't OK.

Create an Apache/conf/ssl directory and move my-server.key and my-server.cert into it.

4.: Configure Apache and mod_ssl

Copy the files from the downloaded apache-mod_ssl distribution over your original Apache installation directory (remember to stop Apache first!).

Find the LoadModule directives in your httpd.conf file and add this after the existing ones:

LoadModule ssl_module modules/ApacheModuleSSL.dll

Add the following to the end of httpd.conf:

# see for more info

SSLMutex sem

SSLRandomSeed startup builtin

SSLSessionCache none

SSLLog logs/SSL.log

SSLLogLevel info

# You can later change this to "warn" if everything is OK


SSLEngine On

SSLCertificateFile conf/ssl/my-server.cert

SSLCertificateKeyFile conf/ssl/my-server.key


You might need to use regedit to change the key HKEY_LOCAL_MACHINE\SOFTWARE\Apache Group\Apache\X.Y.Z to the correct number if the apache.exe from is not the same version as the previously installed one.

Start the server, this time from the command prompt (not as a service) in order to see the error messages that prevent Apache from starting. If everything is OK, (optionally) press CTRL+C to stop the server and start it as a service if you prefer.
If it doesn't work, Apache should write meaningful messages to the screen and/or into the error.log and SSL.log files in the Apache/logs directory.
If something doesn't work, set all LogLevels to the maximum and look into the logfiles. They are very helpful.


Apache Web Server:
mod_ssl configuration:
PHP Hypertext preprocessor:

Author of this document: Balázs Bárány ( (mail me your questions)
Contributor: Horst Bräuner (OpenSSL configuration on NT)
Contributor: Christoph Zich (Windows 98)

Last change: 2000-04-21