Setup HTTPS' in XAMPP For Localhost
Setup HTTPS' in XAMPP For Localhost
FYI — The generated .crt & .key will be stored in C:\xampp\apache\conf\ssl.crt and
C:\xampp\apache\conf\ssl.key folders respectively. No need to move them, but you will
need to tell your httpd-vhosts.conf file where they are (Step 4).
<Directory "C:/xampp/htdocs/xampp">
<IfModule php7_module>
<Files "status.php">
</Files>
</IfModule>
AllowOverride AuthConfig
SSLRequireSSL
</Directory>
Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
<Directory "C:/xampp/phpMyAdmin">
Open in app Get started
AllowOverride AuthConfig
Require local
SSLRequireSSL
</Directory>
<Directory "C:/xampp/webalizer">
<IfModule php7_module>
<Files "webalizer.php">
</Files>
</IfModule>
AllowOverride AuthConfig
Require local
SSLRequireSSL
</Directory>
This next optional step is to redirect “http” requests to “https” requests for the pages
we want to secure. This is more user friendly and allows you to still use http when you
type in the address (and automatically switch to https:// and encryption). If you don’t
do this, and you used SSLRequireSSL, you will only be able to access these pages by
typing https://. This is fine and probably a little bit more secure, but is not so user
friendly. To accomplish the redirection, we will use mod_rewrite so that we don’t have
to use the server name in this part of the config file. This helps keep small the number
of places in the config files where the server name is written (making your config files
more maintainable).
Now paste all this text to the config file at address E:\xampp\apache\conf\extra\httpd-
xampp.conf (That is rewrite URL, if not, you can't access your site via SSL):
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>
<virtualhost *:443>
ServerAdmin webmaster@awesomesite.localhost.com
DocumentRoot "C:/xampp/htdocs/awesomesite/"
ServerName awesomesite.localhost.com
ServerAlias www.awesomesite.localhost.com
ErrorLog "logs/awesomesite.localhost.com-error.log"
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
</virtualhost>
Note that chrome will indicate that the URL is Note Secure. This is normal for a non-
verified cert. No worries, you are good to go now.