iAhtisham

How to Enable HTTPS on XAMPP Server

web-development
wordpress
SSL
HTTPS
How to Enable HTTPS on XAMPP Server

Following are Steps to setup HTTPS for XAMP;

STEP 1 Installing XAMMP

Download and install XAMPP Here

STEP 2 Adding VirtualHost

Navigate to C:\xampp\apache\conf\extra

Open httpd-vhosts-conf file in Notepad add a VIRTUALHOST in the end by copying following code

1# Virtual Hosts
2<VirtualHost *:443>
3 DocumentRoot "C:/xampp/htdocs/"
4 ServerName localhost
5 SSLEngine on
6 SSLCertificateFile "conf/ssl.crt/server.crt"
7 SSLCertificateKeyFile "conf/ssl.key/server.key"
8 <Directory "C:/xampp/htdocs/">
9 Options All
10 AllowOverride All
11 Require all granted
12 </Directory>
13</VirtualHost>
14

ServerName will be the URL you want to setup HTTPS on; In this case We are using localhost

STEP 3 Creating Private Key

Now We will create Private KEY. Navigate to the directory C:\xampp\apache.

Open makecert.bat.

It will ask Pass Phrase and some questions,You can give answers of your choices but the comman name should be the URL for which you are setting up SSL for; in this case its "localhost".

Once done with it you can find the certificates and Key folder in the following directory

C:\xampp\apache\conf

STEP 4 Configure httpd.config

Now, Navigate to C:\xampp\apache\conf. We will be configuring our httpd.config file,

All we need to do is to include following lines in the very bottm of httpd.config file.

1# Virtual hosts
2Include conf/extra/httpd-vhosts.conf
3

STEP 4 Installing Certificate

Now, Open ssl.crt folder and Install the certificate on the local machine by follwing steps;]

  • open server.crt
  • click install certificate
  • click local machine, then proceed next
  • click on **Place all certificates in the following store"
    • Browse and Choose Trusted Root Certification Authorities, click OK and NEXT
    • Click Finish

A message will pop up saying ""the import was successfull""

STEP 5 Configure Chrome

We will enable Allow invalid certificates for resources loaded from localhost. in Chrome. for this paste the following on URL, it will lead you directly to it.

chrome://flags/#allow-insecure-localhost

Restart your XAMPP services and restart chrome as well. You should now be able to access your website with HTTPS / SSL enabled.

Support Me!!

If you found this post helpful, consider buying me Coffee ☕. Your support keeps me fueled to create more content!