How to install SSL on localhost with Xampp and Windows

If you are a Magento developer, you should not skip installing SSL on your localhost because during the development of modules, there may be some cases that require your website to support the https protocol, especially when it involves using webservices or developing payment modules.

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>

Step 5

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

Add line site.local      127.0.0.1

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

127.0.0.1 site.local
Back to Top