How to install SSL on localhost with Xampp and Windows

The post is to instruct you how to install SSL on localhost with Xampp and Windows

Important! You need to have 2 files cert.conf and makecert.bat, please download the files here.

Step 1

Put cert.conf and makecert.bat in xampp/apache/crt (Please create crt folder before that)

Step 2

Open makecert.bat file and enter your information it like below images:
How to  install ssl on localhost with xampp - Enter your site

You can enter your domain name as you expected, in this example, we use domain name as site.local

site.local folder is generated automatically with 2 files in there (server.crt, server.key)

Step 3

Open server.crt file in xampp\apache\crt\site.local  and do the steps as below images:

How to install ssl on localhost with xampp step 2

How to install ssl on localhost with xampp step 3

How to install ssl on localhost with xampp step 4

click on Next then Finish

Step 4

Edit httpd-xapp.conf in xampp\apache\conf\extra

add the scripts at the bottom of the file like below scripts:

<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs"
ServerName site.local
ServerAlias *.site.local
</VirtualHost>

<VirtualHost *:443>
DocumentRoot "D:/xampp/htdocs"
ServerName site.local
ServerAlias *.site.local
SSLEngine On
SSLCertificateFile "crt/site.local/server.crt"
SSLCertificateKeyFile "crt/site.local/server.key"
</VirtualHost>

Config SSL on localhost

Step 5

Edit hosts file in C:\Windows\System32\drivers\etc

Add line site.local      127.0.0.1

How to install ssl on localhost with xampp - edit hosts file