Search
Close this search box.
Search
Close this search box.

How to Enable HTTPS / SSL on WAMP Server

WampServer is a great tool for building a website on your local computer but as of right now it does not support HTTPS / SSL out of the box. Building your website from the ground up with HTTPS / SSL in mind can save you a lot of problems when you finally do put your site online.

Step 1: Download and Install OpenSSL

OpenSSL is available in both 32 and 64 bit. Make sure you select the correct installer for your version of Windows. You can find the latest version of OpenSSL here. In my case I downloaded the Win64 OpenSSL v1.1.1g Light exe version. Navigate to your downloads folder and double click the installer. When Installing OpenSSL leave all settings default.

Step 2: Create Your Key and Certificate

Open your start menu and Load Command Prompt as an Administrator and run the following commands.

First, we will need to change our directory to where we installed OpenSSL.

cd c:/program files/openssl-win64/bin/

Next, we will create our private key. You will be asked for a passphrase. Make it anything you want just make sure you remember it for the next step.

openssl genrsa -aes256 -out private.key 2048

You will need to insert your key 2 times (you will not see it when you write it, just write it and press enter).

openssl rsa -in private.key -out private.key

You will need to add your key one more time.

Next, we will create our certificate. You will be asked several questions on this step. You can put whatever you like or just hit enter to leave it at default. The only one that really matters is Common Name (e.g. server FQDN) you will need to type “localhost” for this.

openssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500

Step 3: Move Your Key and Certificate

Create a folder named “key” in the c:/wamp64/bin/apache/apache2.4.41/conf/ directory.

Navigate to c:/program files/openssl-win64/bin/ to find the certificate.crt and private.key that you just created. Both of these need to be moved to the new folder c:/wamp64/bin/apache/apache2.4.41/conf/key/.

Step 4: Edit Your httpd.conf File

Open c:/wamp64/bin/apache/apache2.4.41/conf/httpd.conf and un-comment (remove the #) the following 3 lines:

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

Step 5: Edit Your httpd-ssl.conf File

Open c:/wamp64/bin/apache/apache2.4.41/conf/extra/httpd-ssl.conf and change all the parameters to the ones shown below.

DocumentRoot "c:/wamp64/www"
ServerName localhost:443
ServerAdmin admin@example.com
ErrorLog "${SRVROOT}/logs/error.log"
TransferLog "${SRVROOT}/logs/access.log"
SSLSessionCache "shmcb:${SRVROOT}/logs/ssl_scache(512000)"
SSLCertificateFile "${SRVROOT}/conf/key/certificate.crt"
SSLCertificateKeyFile "${SRVROOT}/conf/key/private.key"
CustomLog "${SRVROOT}/logs/ssl_request.log"

If you get an error (CustomLog takes two or three arguments…) change last line to 

CustomLog "${SRVROOT}/logs/ssl_request.log" common

DocumentRoot needs to be set to the location of your website files.

Step 6: Restart WampServer

Everything should be set up now. Make sure you restart WampServer for the changes to take effect. If you see a green WAMP icon everything should be right. If the icon is orange there is a problem with your syntax somewhere.

You can run c:/wamp64/bin/apache/apache2.4.41/bin/httpd -t in command prompt and if there are any syntax errors they will be listed.

You should now be able to access your website with HTTPS / SSL enabled.

Learning Resources

How to Enable HTTPS / SSL on WAMP Server 3.1.7