Building the websites on a development environment that keeps HTTPS / SSL in mind can save us from a lot of problems while the site become live. In the WAMP server, a tool for building websites, we need to enable SSL manually.
As a part of our Server Management Services, we help our Customers to fix SSL related errors regularly.
Let us today discuss on how to enable SSL in WAMP server.
How to enable SSL in WAMP server?
Let us now look into the steps to enable SSL in WAMP server.
1. Download and Install OpenSSL
The first step to enable SSL is to install OpenSSL in the server. OpenSSL is available in both 32 and 64 bit. Make sure to select the correct installer for the version of Windows that you use.
Navigate to your downloads folder and double click the installer. While Installing OpenSSL, make sure to leave all the settings to the default one.
2. Create SSL Private Key and Certificate
Once the OpenSSL is installed, next step is to create the private key and the certificate. Step to perform this include:
1.Open Start menu, open the command prompt and “Run as Administrator”.
2.Next, change the directory to where we installed OpenSSL.
cd c:/program files/openssl-win64/bin/
3.Then, we will create the private key. It then asks for a passphrase. We could choose anything, just make sure to remember it for the next step.
openssl genrsa -aes256 -out private.key 2048 #generating private key
openssl rsa -in private.key -out private.key #removing the pass phrase
4.Next, we will create a certificate. This will ask for several questions on this step. Make sure to enter the Common Name correctly. We will need to type “localhost” for this.
openssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 #creating the certificate
3.Copy the Created SSL Key and Certificate file
After generating the key and the certificate, we need to copy that file. First create a folder named “key” in the c:/wamp64/bin/apache/apache2.4.41/conf/ directory. Then navigate to c:/program files/openssl-win64/bin/ to find the certificate.crt and private.key that you just created. Both of these need to be copied to the new folder c:/wamp64/bin/apache/apache2.4.41/conf/key/.
4.Edit the httpd.conf File
After copying the files, we need to edit the httpd.conf File. 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
After that , confirm that the following line is uncommented in the “php.ini” located at “C:\wamp64\bin\php\php7.0.10\php.ini“.
extension=php_openssl.dll
5.Edit the httpd-ssl.conf file
Now we need to edit the httpd-ssl.conf File. Open c:/wamp64/bin/apache/apache2.4.41/conf/extra/httpd-ssl.conf and change all the parameters to the ones shown below.
SSLSessionCache "shmcb:${SRVROOT}/logs/ssl_scache(512000)"
<VirtualHost *:443>
DocumentRoot "c:/wamp64/www"
ServerName localhost:443
ServerAdmin admin@example.com
ErrorLog "${SRVROOT}/logs/error.log"
TransferLog "${SRVROOT}/logs/access.log"
SSLCertificateFile "${SRVROOT}/conf/key/certificate.crt"
SSLCertificateKeyFile "${SRVROOT}/conf/key/private.key"
CustomLog "${SRVROOT}/logs/ssl_request.log"
</VirtualHost>
Set the DocumentRoot to the location of the website files. The ServerName can be “localhost” or the name choosen to access the website in the web browser like “example.com”.
6.Restart WampServer
Final step is to restart the WampServer for the changes to take effect. A green WAMP icon indicates that everything should be right. If the icon is orange there is a problem with the syntax somewhere.
Running the c:/wamp64/bin/apache/apache2.4.41/bin/httpd -t in command prompt will list the syntax errors if any.
This will enable to access the website with HTTPS / SSL enabled.
Note : You will get a security warning which is because we are using the self-signed certificate. You need to add it to an exception to access the page.
[Need any further assistance in fixing SSL errors? – We’re available 24*7]
Conclusion
In short, a website in a WAMP server does not support SSL by default. Today, we saw how our Support Engineers enable ssl in WAMP server.
I did everything to the letter! And I still get “Your connection isn’t private” when going to my site, and it says NET:ERR_CERT_AUTHORITY_INVALID” when I KNOW it’s correct. Please help!
Hello Dan,
Please contact our support team through live chat.