xampp-domain-ssl
Add custom domain to XAMPP projects in Localhost and make those are SSL Certified
1. Windows Host Edit
Backup & add entries to C:\Windows\System32\drivers\etc\hosts
127.0.0.1 localhost #For localhost
127.0.0.1 akjpro.in #For new domain(s)
2. SSL Certificate creation
Create folder C:\xampp\apache\cert
and Download following files in this folder
i) https://raw.githubusercontent.com/akjpro/xampp-domain-ssl/main/src/cert.conf
Download
ii) https://raw.githubusercontent.com/akjpro/xampp-domain-ssl/main/src/make-cert.bat
Download
Replace \{\{YOUR DOMAIN NAME}}
with your domain name in cert.conf
file (Lines : 25 & 51)
Run make-cert.bat
by double clicking on it. And when prompt, enter your domain name.
3. SSL Certificate Installation
Double click on the server.crt
to install it on Windows. so Windows can trust it.
In prompt, click Install Certificate
-> Local Machine
-> Next
-> Place all certificate in the following store
-> Browse
-> Trusted Root Certification Authorities
-> OK
-> Next
-> Finish
4. Adding VirtualHost entries
Backup & add entries to C:\xampp\apache\conf\extra\httpd-vhosts.conf
and replace \{\{YOUR-PROJECT-DIR}}
with your project directory & \{\{YOUR-DOMAIN-NAME}}
with your domain name
NameVirtualHost *:80 #For localhost <VirtualHost *:80> DocumentRoot "c:/xampp/htdocs" ServerName localhost <Directory "c:/xampp/htdocs">; Require all granted </Directory> </VirtualHost> #For new domain(s) <VirtualHost *:80> DocumentRoot "c:/xampp/htdocs/\{\{YOUR-PROJECT-DIR}}" ServerName \{\{YOUR-DOMAIN-NAME}} <Directory "c:/xampp/htdocs/\{\{YOUR-PROJECT-DIR}}"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> SSLEngine on SSLCertificateFile "crt/\{\{YOUR-DOMAIN-NAME}}/server.crt" SSLCertificateKeyFile "crt/\{\{YOUR-DOMAIN-NAME}}/server.key" </VirtualHost></code>
5. Restrat Apache in Xampp & Browser
Open XAMPP Control Panel and Stop and Start Apache Module.