How to Enable HTTPS / SSL in Localhost

In this blog post I will walk you through on how you can enable HTTPS on your localhost and install a SSL certificate. You might have good reasons to do this but in my case I had to test woocomerce api over https just so that I could have my development environment as close to production as possible. So let’s get started:

First thing you need to do is install a local certificate. And the tool I used is mkcert. Since I am working on Windows I had to install Chocolatey first. Once chocolatey is installed you can open a command terminal (with elevated privileges) and then do this command:

choco install mkcert

Once that is done you need to add mkcert to your local Certificate Authority or CA. If you don’t do that your certificate will not be trusted by the browser since it won’t know who signed it. To add mkcert to local CA execute this command:

mkcert -install

Now you can generate your local certificate like this (if you have a different host name then enter that e.g.

mkcert localhost

After this you should have a local certificate signed by mkcert. You should have two files:

<doman name>.pem 
<doman name>-key.pem

These files are generated wherever you run the command above. Now we need to configure WAMP to use SSL and provide these files. Copy these two files and place them wherever your SRVROOT is pointing. To find that out open httpd.conf file and look for the SRVROOT token. Usually it’s pointing to:


You can open httpd.conf file by left clicking on the Wamp icon in the system tray.

Httpd.conf file location – Grepsoft.

You need to uncomment (remove the #) two lines:

#LoadModule ssl_module modules/
#LoadModule socache_shmcb_module modules/

After doing that open httpd-ssl.conf file located at:


and change these two variables to point to your cert and key file.

SSLCertificateFile "${SRVROOT}/conf/<domain>.pem"
SSLCertificateKeyFile "${SRVROOT}/conf/<domain>-key.pem"

You should also search for ServerName variable and change it to whatever your domain is. For me it was set to so I changed it to localhost:443. Now restart Wamp server.

Forbidden : You don’t have permissions to access / on this server

If you try to access https://localhost:443 you might get permission denied error. To fix this you need to change DocumentRoot in the httpd-ssl.conf file. I pointed mine to www like this:

DocumentRoot "${INSTALL_DIR}/www"

Now if you try it should work!

To see any errors thrown by wamp server you can open Windows Event Viewer and see them there. For example I had ssl on but I did not put the right certificate file and when I checked the Event Viewer I saw this:

Use Windows Event Viewer to see errors thrown by Wamp server – Grepsoft

You can also read this article for further information.