Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Enable Local HTTPS in XAMPP on Windows

Set up a trusted local certificate and an Apache HTTPS virtual host in XAMPP, then check configuration, hostname, and port errors.

Table of Contents

To test HTTPS in XAMPP on Windows, create a certificate for a local development name, configure Apache to serve it, and make sure your browser trusts the issuing local certificate authority. Use this setup on an authorized development computer. A public site needs a certificate its visitors can already trust and a production server configuration.

9 Steps to Install SSL for Xampp in Most Detail Picture 1
XAMPP’s Apache server can use a separate HTTPS virtual host for local testing.

1. Choose a local name and certificate

Use a development-only name such as app.test. If you manage the computer, open the Windows hosts file at C:WindowsSystem32driversetchosts in an elevated text editor and add 127.0.0.1 app.test. If policy allows it, obtain mkcert from its project and use it to create a local certificate. The first command installs the local CA in the trust store. Run it only on an authorized development system and keep the CA private key private.

mkcert -install
mkcert -cert-file app.test.pem -key-file app.test-key.pem app.test

Move the resulting files to a location outside the website directory, such as C:/xampp/apache/conf/ssl-local/. Never put the key in source control or the web root.

2. Configure Apache’s HTTPS virtual host

Back up your Apache configuration. Confirm that the main httpd.conf loads mod_ssl and includes the HTTPS configuration. Check that there is a suitable Listen directive for port 443. Avoid adding a duplicate listener and change an existing linked virtual host if it already serves the same name.

<VirtualHost 127.0.0.1:443>
    ServerName app.test
    DocumentRoot "C:/xampp/htdocs/app"
    SSLEngine on
    SSLCertificateFile "C:/xampp/apache/conf/ssl-local/app.test.pem"
    SSLCertificateKeyFile "C:/xampp/apache/conf/ssl-local/app.test-key.pem"
</VirtualHost>

Use your actual XAMPP and project paths. This example binds the virtual host to loopback. Review Apache’s listener settings separately if you need to prevent other interfaces from accepting connections. See the Apache TLS configuration guide and the basic XAMPP Windows setup.

3. Test the configuration and browser connection

From the XAMPP Apache bin folder in Command Prompt, run httpd.exe -t to check syntax. Restart Apache in the XAMPP control panel and visit https://app.test. If Apache fails to start, check the logs for a path or port conflict. If the browser warns about the certificate, verify the hostname, trust chain, and system time. Keep the warning in place while finding the cause with the TLS troubleshooting guide.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.