How to Fix XAMPP SSL Certificate Not Trusted on Localhost (mkcert Guide)

Advertisement

Google AdSense In-Article Display Placement

Publisher ID: ca-pub-XXXXXXXXXXXXXXXX (Configured in config.php)

Testing Progressive Web Apps (PWAs), payment gateways, and geolocation locally requires genuine HTTPS. Self-signed XAMPP certs trigger red warning pages.

✔ Rapid Direct Solution

Use mkcert (a zero-config tool that creates a locally trusted Certificate Authority). Run "mkcert -install", then "mkcert localhost 127.0.0.1". Point SSLCertificateFile and SSLCertificateKeyFile in httpd-ssl.conf to the generated cert and key. Restart Apache.

1. Problem Diagnosis & Symptoms

Chrome and modern browsers strictly reject untrusted root CAs.

2. Primary Root Causes

  • Cause: Default XAMPP certificate is self-signed without trusted root.

3. Step-by-Step Diagnostic Fixes

1

Generate Trusted Local Certificate with mkcert

Install mkcert via winget or chocolatey, then generate certs:

CMD
mkcert -install
mkcert localhost 127.0.0.1 ::1

4. How to Verify the Resolution

  • ✔ Navigate to https://localhost and verify the secure padlock.

5. Diagnostic Troubleshooting Matrix

Symptom Observed Root Cause Recommended Action
Chrome still says NET::ERR_CERT_AUTHORITY_INVALID Local CA was not added to browser trust store Run mkcert -install again and restart the browser

6. Critical Mistakes to Avoid

  • ❌ Never publish private local CA keys to public repositories.

7. Frequently Asked Questions

❓ Does mkcert work for custom virtual hosts too?

Yes! Simply pass the domain name: mkcert myproject.test.

Official Technical References

Advertisement

Google AdSense In-Article Matched Content Unit