Objective
To provide a step-by-step guide to import SSL certificate into a WampServer environment.
Prerequisites
- OpenSSL installed on local machine.
- WampServer installed on local machine.
- Access to the origin IIS server where the CSR was generated.
Steps
Step 1: Export the Certificate with Private Key from IIS
On your origin Windows server, navigate to the IIS Manager.
Select the server name in the Connections pane on the left.
Double-click on Server Certificates in the middle pane.
Locate your certificate, right-click, and select Export.
Specify the file path and filename (e.g.: your_certificate.pfx), and set a password.
Step 2: Transfer the .pfx File to the WampServer host.
Transfer the newly-exported .pfx file to the WampServer host.
Step 3: Extract the Certificate and Private Key
Open up the Command Prompt and navigate to the directory containing your_certificate.pfx.
Run the following command to extract the private key: –
openssl pkcs12 -in your_certificate.pfx -nocerts -out private.key
Then, enter the password you have defined during Step 1 and set a new password for the private.key file when prompted.
To remove the passphrase from the private key (Optional but recommended for server run), run the following command: –
openssl rsa -in private.key -out server.key
Extract the certificate by running: –
openssl pkcs12 -in your_certificate.pfx -clcerts -nokeys -out server.crt
Step 4: Configure Apache in WampServer to Utilize the SSL Certificate
Within the WampServer installation, navigate to C:\wamp64\bin\apache\apache2.x.y\conf\ and create a new directory / folder named ssl
Move the server.key and server.crt into the ssl folder.
Open httpd.conf located at C:\wamp64\bin\apache\apache2.x.y\conf\httpd.conf and uncomment the following lines by removing the # at the beginning.
LoadModule ssl_module modules/mod_ssl.so Include conf/extra/httpd-ssl.conf LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
Save and close httpd.conf
Open httpd-ssl.conf located at C:\wamp64\bin\apache\apache2.x.y\conf\extra\httpd-ssl.conf and update the following directives: –
DocumentRoot "C:/wamp64/www" ServerName localhost:443 SSLCertificateFile "${SRVROOT}/conf/ssl/server.crt" SSLCertificateKeyFile "${SRVROOT}/conf/ssl/server.key"
Save and close httpd-ssl.conf
Step 5: Restart WampServer
Restart all WampServer services to apply the changes. The WampServer icon should turn green, indicating all services are running accordingly.
Step 6: Test SSL Configuration
Open up a browser and navigate to your site https://your_domain_name/. You should see your site loading over HTTPS.