How to add SSL/HTTPS to localhost WAMP Server

Setup SSL On Localhost

Install OpenSSL

Download appropriate OpenSSL as per your windows bit (32-bit / 64-bit) from http://slproweb.com/products/Win32OpenSSL.html and install. While installing the setup it will ask you to select a directory for installation. You can install in any drive. So I am installing in my ‘E’ drive. You can read our article How to Install OpenSSL Light on Windows 10.

And after install its path is E:\OpenSSL-Win64


Generate self-signed key and certificates for localhost

Open E:\wamp64\bin\apache\apache2.4.33\conf\ folder and create a folder ‘ssl-certs’. Now, in cmd (Command Prompt) navigate to E:\wamp64\bin\apache\apache2.4.33\conf\ssl-certs directory and run following command. You can change the value for -days to the expiry days. I am creating certificates for the very long-term 😀

After certificates & key successfully created you should match that certificate with it’s key. Match your SSL Certificate & Private key on SSL Shopper.  Now, paste the content of key & certificate files into respected textareas. See image below for your perusal.

localhost ssl matched

Update conf files and include certificates

Open E:\wamp64\bin\apache\apache2.4.33\conf\httpd.conf file in a text editor

Add following lines just next to Listen 80 OR List 0.0.0.0:80

Remove the comment ‘#‘ from the line

So it should now look like

Similarly, remove ‘#’ from below lines in the same file

Open E:\wamp64\bin\apache\apache2.4.33\bin\php.ini in a text editor
Make sure the following line is uncommented by removing the semicolon (;) from the beginning.

Now, open Include conf/extra/httpd-vhosts.conf and add following lines next to the closing tag of <VirtualHost *:80>

This CA Root certificate is not trusted because it is not in the Trusted Root Certification Authorities store. To make it trusted on your localhost you can read our Article on this.

Leave a Reply