After after days of work i finally get out how to Secure your XAMPP localhost with a SSL Certificate. In the following example i will use „localhost“ as hostname. You can choose another name as well.
First you have to Download mkcert here
then just use it to create the pem files
mkcert -install localhost 127.0.0.1
Now just follow the instructions.
If all is going right – you get the following output:
The certificate is at "./localhost+1.pem" and the key at "./localhost+1-key.pem"
Now copy the file „localhost+1.pem“ to your xampp folder in the folder
Then copy the „localhost+1-key.pem“ file to the folder
Okay – now you are nearly done.
Now edit the file
And add the lines below
<VirtualHost *:80> DocumentRoot "C:/xampp/htdocs" ServerName localhost ServerAlias *.localhost </VirtualHost> <VirtualHost *:443> DocumentRoot "C:/xampp/htdocs" ServerName localhost ServerAlias *.localhost SSLEngine on SSLCertificateFile "C:\xampp\apache\conf\ssl.crt\localhost+1.pem" SSLCertificateKeyFile "C:\xampp\apache\conf\ssl.key\localhost+1-key.pem" </VirtualHost>
Now save it and start Apache in XAMPP – Now you can open the localhost via
It should work now as SSL Connections.
If you want to add to another URL – just edit the hosts File from Windows and replace the Host in the Example above.
Okay – thats all!
I wish you good Luck and much fun 🙂