Following are some easy steps to setup enviroment to use HTTPS on WAMP.
It is Important that you have already got WAMP installed, If not you can download WAMP from here.
After you've downloade and installed WAMP; the steps are as follows,
Both 32 and 64-bit versions of OpenSSL are available. Make sure you're using the right installation for your Windows version. The most recent version of OpenSSL may be found here. When Installing OpenSSL leave all settings default.
-
Load Command Prompt as an Administrator from your start menu and run the commands below. To begin, navigate to the directory where OpenSSL was installed.
cd c:/program files/openssl-win64/bin/
-
Generate your Private key by using follwing command.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
openssl rsa -in private.key -out private.key
-
Now, create your Certificate thorough following commad,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
-
Create a folder named "KEY" in the directory C:\wamp64\bin\apache\apache2.4.51\conf
-
Copy the generated
private.key
andcertificate.crt
files from C:\Program Files\OpenSSL-Win64\bin to the C:\wamp64\bin\apache\apache2.4.27\conf\key folder.
-
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
- 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 [email protected]
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"
- The DocumentRoot folder is the location where the website files are located. The ServerName can be set as localhost" or the name set to access the website like "example.com"
-
Everything should be set up now. Make sure you restart WampServer for the changes to take effect.
-
If there will be any syntax error, you can check it by navigating to c:/wamp64/bin/apache/apache2.4.41/bin in Command Prompt and run following command;
httpd -t
You should now be able to access your website with HTTPS / SSL enabled.