How to add SSL / HTTPS to WampServer

With the importance of HTTPS for security and SEO (according to Google), you need a development environment that lets you run your site locally on https. Unfortunately, right out of the box, WampServer only includes a parts of what you need to get your local web server running over https://localhost.

In this article, we will go over the exact steps you can follow to get HTTPS / SSL working on your Wamp Server. These instructions assume that you are installing the 64-bit version of WampServer for Windows to your c: drive. If not, just replace c: with d:. You may also need to change the version number in some of the paths depending on when you downloaded Wamp Server.

How to use WAMP + SSL to open localhost over https:

  1. Download & install WampServer.
  2. Open a command prompt (WindowsKey + R > cmd > click OK) and enter the following commands.
    cd c:\wamp64\bin\apache\apache2.4.27\bin
    openssl genrsa -aes256 -out private.key 2048
    openssl rsa -in private.key -out private.key
    openssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -config c:\wamp64\bin\apache\apache2.4.27\conf\openssl.cnf
    Note: You can pretty much answer the questions any way you want though real answers are best. The one question that really matters here is the FQDN. It should be: localhost
  3. Using a text editor like Notepad, open c:\wamp64\bin\apache\apache2.4.27\conf\httpd.conf and un-comment 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
  4. Using a text editor like Notepad, open c:\wamp64\bin\apache\apache2.4.27\conf\extra\httpd-ssl.conf and apply the following changes:
    Below the line: <VirtualHost _default_:443>, check the following parameters to ensure they are configured correctly and not commented.
    -------------------------------------
    DocumentRoot "c:/wamp64/www"
    ServerName localhost:443
    ServerAdmin admin@example.com
    SSLSessionCache "shmcb:c:/wamp64/bin/apache/apache2.4.27/logs/ssl_scache(512000)"

    ErrorLog "c:/wamp64/bin/apache/apache2.4.27/logs/error.log"
    TransferLog "c:/wamp64/bin/apache/apache2.4.27/logs/access.log"
    SSLCertificateFile "c:/wamp64/bin/apache/apache2.4.27/conf/certificate.crt"
    SSLCertificateKeyFile "c:/wamp64/bin/apache/apache2.4.27/conf/private.key"
    -------------------------------------
  5. Save the file and close it.
  6. You are done. To check the validity of file, at the command prompt, enter:
    c:\wamp64\bin\apache\apache2.4.27\bin\httpd -t
    and then use your web browse to go to https://localhost/

From this point on, you should be able to start, stop and restart Wamp Server and SSL-HTTPS will continue to work.

Enjoy!

Michael Milette


Leave a Reply

Your email address will not be published. Required fields are marked *