Setting up SSL on a local xampp/apache server

Setting up SSL on a local xampp/apache server

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Enabling SSL on XAMPP for Active Directory Integration

Setting up SSL on a local XAMPP stack to facilitate secure communication with Active Directory requires understanding how Apache handles certificates and how PHP interacts with them. When integrating tools like adLDAP, the goal is typically to encrypt the connection between your browser (or script) and the LDAP server, or to ensure that local traffic is served over HTTPS when accessing internal directories. Since XAMPP is a packaged environment running on Windows, you do not have direct access to system-level certificate stores in the same way a Linux VPS does; instead, you must configure Apache to trust specific certificates within its own context.

The most straightforward approach for local development without purchasing an enterprise certificate involves using localhost or a self-signed certificate generated via OpenSSL. XAMPP includes OpenSSL binaries by default, which allows you to create a Certificate Signing Request (CSR) and a private key directly from the command line. You can navigate to the xampp\openssl\bin directory and run the following command to generate a basic self-signed certificate:

openssl req -x509 -newkey rsa:2048 -nodes -sha256 \
    -keyout key.pem -out cert.pem -days 365

This creates two files: key.pem, which contains your private key, and cert.pem, which acts as both the certificate and the Certificate Authority (CA) root. In a production environment, you would submit the CSR to a trusted CA like Let's Encrypt or DigiCert. However, for local testing with adLDAP, trusting this self-signed root is often sufficient because browsers will flag the connection as insecure unless you explicitly trust the issuer.

Once the files are generated, you must configure Apache to use them. Open your XAMPP configuration file located at xampp\apache\conf\extra\httpd-ssl.conf. You will need to enable the SSL module if it isn't already active by ensuring LoadModule ssl_module modules/mod_ssl.so is uncommented and followed by lines pointing to your new certificates:

SSLCertificateFile "C:/xampp/apache/conf/extra/key.pem"
SSLCertificateKeyFile "C:/xampp/apache/conf/extra/cert.pem"

Adjust the paths if you generated the files in a different directory. It is crucial to ensure that these file paths are absolute and correctly referenced by Apache, as relative paths often fail when the service runs under its specific user context. Additionally, verify that your httpd.conf or httpd-ssl.conf has SSLCipherSuite and SSLProtocol directives configured appropriately, though default settings usually suffice for local testing unless specific legacy compatibility is required.

When connecting to Active Directory via adLDAP, you must ensure the PHP environment trusts the CA that signed your certificate. If you are using a self-signed certificate where the server cert is also the root CA, you can add the public key of that certificate to your PHP configuration. This is typically done by adding the path to the certificate file to the openssl.cafile directive in your php.ini or by ensuring the certificate is installed in the system's Trusted Root Certification Authorities store if you intend for browsers to accept it without warnings.

One common pitfall when working with XAMPP and SSL is port conflicts. Enabling HTTPS requires Apache to listen on port 443, which is often blocked by Windows Firewall or occupied by other services. You may need to add an exception in the Windows Defender Firewall settings for the Apache executable or explicitly configure your httpd-ssl.conf to use a non-standard port if necessary, such as Listen 8443.

Finally, remember that while SSL encryption is vital for transmitting credentials securely to Active Directory, it does not authenticate the server by default unless you verify the certificate chain. For local development loops where security through obscurity or explicit trust configuration is acceptable, self-signed certificates provide a functional solution without the overhead of external CAs.

Our network