Last year I wrote a post about Setting up SSL on locahost using XAMPP on Windows for multiple host names and the year before Setting up a self-signed SSL certificate for localhost when using XAMPP on Windows, in them I outlined the steps I used to setup SSL for my localhost. This year having done all the hard work I just need to renew the self signed SSL certificates. So following on from my previous post this year I only have a small number of steps to get my websites humming again with renewed certificates.
As I mentioned in my previous post I could have set the expiry to greater than 365 days but I believe it is worth revisting this kind of thing as a reminder of how it is all working.
The 4 Step Process
- Step 1 – Edit the Script
- Step 2 – Create the Certificates
- Step 3 – Install the Certificates
- Step 4 – Restart Your Computer
Step 1 – Edit the Script
In the previous post I created the script to use in C:\xampp\apache
and called it makecert_bulk.bat. The only pitfall with this was, during the year I did a PHP upgrade of XAMPP to PHP 8.1 resulting in this folder being replaced. Fortunately, as per Step 1 of my instructions on how to upgrade XAMPP without losing anything I had taken a backup and so I was able to go and fetch my previous script from my backup. Before running the script, check that you still need all the certificates you are creating and that you don’t have any new ones to add.
Step 2 – Create the Certificates
Open a command prompt (eg from the Windows start menu type cmd in Windows search) then enter
cd /D C:\xampp\apache
Assuming you have installed xampp in C:\xampp\apache
Now enter:
makecert_bulk
Once this has completed successfully you will find all the private keys and certificates created in :
C:\xampp\apache\conf\ssl.crt
and C:\xampp\apache\conf\ssl.key
Step 3 – Install the Certificates
Go to start menu, type the following and press enter:
certmgr.msc
Double click “Trusted Root Certification Authorities”. Right click “Certificates”, choose All Tasks ->
Import…
Click Next.
It will ask you to choose the certificate file. Click Browse and choose C:\xampp\apache\conf\ssl.crt
\localhost-selfsigned.crt
Click Next.
This will bring you a message. Click Yes.
Then it should say Import was successful.
Repeat this step to install each of the certificates that you created for your virtual hosts.
Step 4 – Restart Your Computer
Unlike previously there is no more setup required as you have already edited your httd-ssl.conf and httpd-vhosts.conf previously to make your self signed certificates works, so now all you have to do is restart your computer so that it picks up the new certificates in your browser.
In the end…
Hopefully you found this useful and time saving, or at least a reminder of how to setup self signed certificates for XAMPP and Windows.