I have a Windows machine and as a developer of WordPress sites, I have to test many sites in Windows. Some of these sites require SSL connections for testing payments and one recently needed a secure connection for testing Webrtc.
So how do we go about installing SSL on a development machine? What is the process?
In this guide, I am sharing with you the step by step process for installing a SSL certification on localhost that is running a XAMPP in Windows.
If you have XAMPP on your machine then openssl already should come with it. If not, then go to https://github.com/openssl/openssl and download and install it. You should install it in such a was then openssl is available under C:\xampp\apache\bin folder.
Next, you just need two files
Download these two files and save them to a folder C:\xampp\apache\ssl . The location C:\xampp\apache is the default location of Apache server if you have XAMPP installed on your machine.
If you have changed the location of the apache folder then change the location of the ssl folder also accordingly. The ssl folder is new and you have to create it.
Edit the file cert.conf and make the following changes.
Change the DNS.1 value to localhost or any local site name you want. It can be site.local – for example.
Run the batch file make-cert.conf and accept all the default values. Make sure to enter the common name as the name you chose earlier. So if you chose localhost then it will be localhost and it you chose site.local then the value will be site.local.
After running the batch file you will have a folder with your site name in ssl folder. If you chose site.local as the common name, then the folder name will be site.local. It will have the certificate and the private key.
Double click on the certification file. A window will open to install the certificate.
Click on install certificate.
You will get a window to chose Current User or Local Machine. Choose local machine
In the next screen chose the option to Place all certificates in the following store and click browse.
A new window will open where you will select Trusted Root Certification Authorities and select ok.
The certificate will be imported and installed in Windows.
Go to C:\Windows\System32\drivers\etc\hosts file and open it in a text editor.
Add the following line at the bottom of the file –
127.0.0.1 site.local
I am assuming that you have chosen site.local as your common name.
Let XAMPP know where the certificate files are.
Open httpd-ssl.conf file and look for the VirtualHost section. If it is not there then create it like this –
<VirtualHost *:443>
DocumentRoot "C:/xampp/htdocs"
ServerName site.local
ServerAlias *.site.local
SSLEngine on
SSLCertificateFile "ssl/site.local/server.crt"
SSLCertificateKeyFile "ssl/site.local/server.key"
</VirtualHost>
If you do not know the location of httpd-ssl.conf file then open XAMPP control panel and click config in apache management section. Choose httpd-ssl.conf file. Update the like as shown above and save.
You are done!
Restart apache and the browser. Your local site now should have a nice lock next to its name.
Copyright Web/ Design/ Vista 2022 ©