setup ssl for apache web server on windows

Setup SSL Certificate for Apache 2.4 web server on Windows

One of the rare installation scenarios is the setup of a SSL certificate for Apache 2.4 web server on Windows. Although it is always recommended to run Apache on Linux, installing SSL certificates for Apache 2.4 web server running on Windows is also easy.

Pre-Requisites/Assumptions

  1. You have the SSL certificate chain (SSL certificate and CA certificate) file and the private key file ready to setup.
    See: How To Get SSLCertificate for Website
  2. You have installed Apache web server to C:\Apache24 on Windows.
  3. You have setup Apache to run as a service in Windows.

apache 2.4 directory contents

Step 1: Place the files in the correct location

Copy the SSL certificate chain file (referred here as server.crt) and the Private key file (referred here as server.key) to the following directory on Windows:

C:\Apache24\conf

Step 2: Edit the Apache SSL configuration file

Find the Apache main configuration file on Windows:

C:\Apache24\conf\httpd.conf

Uncomment the following lines wherever they occur in the file:

LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so

Now edit the following file:

C:\Apache24\conf\extra\httpd-ssl.conf

Modify VirtualHost_default directive. Keep all the default options as it is, but be sure to modify the following lines:

<VirtualHost _default_:443>
DocumentRoot "C:\Apache24\htdocs"
ServerName your_machine_name:443
ErrorLog "C:\Apache24\logs\error.log"
TransferLog "C:\Apache24\logs\access.log"
SSLCertificateFile "C:\Apache24\conf\server.crt"
SSLCertificateKeyFile "C:\Apache24\conf\server.key"
</VirtualHost>

You can keep the default port to 443, and make sure path to the SSL certificate is correct.

Step 3: Restart the Apache web server

You are almost done! Now open an exception in Windows Firewall for TCP port 443.

Then, restart Apache 2.4 service from Windows services.

Test setup of SSL Certificate for Apache 2.4 web server on Windows

Testing the SSL configuration is easy. After completing Step 3, just open the following URL in your web browser:

https://your_machine_name

If you see the web page in your browser then you have succeeded in setting up SSL on Apache 2.4 web server on Windows.

Tagged , , , , , .