Menu Share

SSL certificates for XAMPP WAMP Developers

I use XAMPP for site development, on Windows 10. XAMPP has ssl built in, but how to get those ssl certificates, right? I will tell you how I do it.

Suppose I want to develop a ssl website, lets say testing.dom. First I add testing.dom and www.testing.dom to my Windows hosts file in C:\Windows\System32\drivers\etc\hosts .

Then use this site to generate a certificate and private key.

Copy the private key in (your drive)\xampp\apache\conf\ssl.key\testing.dom.key

Copy the certificate in (your drive)\xampp\apache\conf\ssl.crt\testing.dom.crt

Import the root certificate (ca.ssl.indexnl.com.crt) with the Certificate Import Wizard, just double click and -Install Certificate-, make sure you import the root certificate in the Trusted Root Certificate Authorities Store.

Then I go to my (your drive)\xampp\apache\conf\extra\httpd-vhosts.conf and add the domain like this:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "(your drive)\xampp\htdocs\www.testing.dom"
    ServerName testing.dom
    ServerAlias www.testing.dom
    ErrorLog "logs/www.testing.dom-error.log"
    CustomLog "logs/www.testing.dom-access.log" common
</VirtualHost>

Then, add the SSL virtualhost to the (your drive)\xampp\apache\conf\extra\httpd-ssl.conf like this: (remove the entries of example.com in that file, they cause an error!)

<VirtualHost *:443>
    ServerAdmin [email protected]
    DocumentRoot "(your drive)\xampp\htdocs\www.testing.dom"
    ServerName testing.dom
    ServerAlias www.testing.dom
	SSLEngine on
	 SSLCertificateFile "(your drive)\xampp\apache\conf\ssl.crt\testing.dom.crt"
	 SSLCertificateKeyFile "(your drive)\xampp\apache\conf\ssl.key\testing.dom.key"
	 <FilesMatch "\.(cgi|shtml|phtml|php)$">
	 SSLOptions +StdEnvVars
	 </FilesMatch>
	ErrorLog "logs/www.testing.dom-error.log"
    CustomLog "logs/www.testing.dom-access.log" common
</VirtualHost>

The certificate is a wild card certificate, so you can add an unlimited number of subdomains, just add them to your hosts file too. The Windows hosts file does not support wildcards like *.testing.dom, so you have to add every subdomain.

Restart XAMPP Apache, and goto https://www.testing.dom/ to test. Works! (For Firefox you will need to install the root certificate in the browser, other browsers use the Windows Certificate store)