Skip to main content
wamp

How to setup https on local machine?

By March 28, 2018June 17th, 2018No Comments

This got essential after Facebook mandatorily required https as referrer url for facebook login.

This guide I followed entirely and it worked like a charm: https://www.proy.info/how-to-enable-localhost-https-on-wamp-server/

I used answer of alexkb at https://stackoverflow.com/questions/2355568/create-a-openssl-certificate-on-windows for creating cert and private key.

The command

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout privatekey.key -out certificate.crt

For setting up virtual host, paste following in httpd-vhosts.conf

say you setup https://social.dev.com then you also need to setup in etc/hosts for social.dev.com without https. So one entry in hosts file for http and one for https.

ServerName dev.com
DocumentRoot c:/wamp/www/
SSLEngine On
SSLCertificateFile “c:/wamp/bin/apache/apache2.4.23/conf/key/certificate.crt”
SSLCertificateKeyFile “c:/wamp/bin/apache/apache2.4.23/conf/key/private.key”
<Directory “c:/wamp/www/”>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local