Xampp installation

XAMPP Apache SSL Certificate Installation Manual for Windows Server

Table of Contents

  1. Prerequisites
  2. Certificate Preparation
  3. XAMPP Configuration
  4. Virtual Host Setup
  5. Testing and Verification
  6. Troubleshooting

Prerequisites

Before starting, ensure you have:

Certificate Preparation

Step 1: Organize Certificate Files

Create a dedicated folder for your SSL certificates:

C:\xampp\apache\conf\ssl\

Place your certificate files in this directory:

Step 2: Verify Certificate Files

Ensure your certificate files are in the correct format:

XAMPP Configuration

Step 3: Enable SSL Module

  1. Open XAMPP Control Panel as Administrator
  2. Stop Apache if it's running
  3. Navigate to C:\xampp\apache\conf\httpd.conf
  4. Find and uncomment (remove #) the following line:
    Include conf/extra/httpd-ssl.conf
    
  5. Also ensure the SSL module is loaded by uncommenting:
    LoadModule ssl_module modules/mod_ssl.so
    

Step 4: Configure SSL Settings

  1. Open C:\xampp\apache\conf\extra\httpd-ssl.conf
  2. Locate the default SSL virtual host section (usually starts around line 104)
  3. Comment out or modify the default SSL virtual host to avoid conflicts

Virtual Host Setup

Step 5: Create Virtual Host Configuration

  1. Open C:\xampp\apache\conf\extra\httpd-vhosts.conf

  2. Add your HTTP virtual host (port 80):

    <VirtualHost brspace.bankrakyat.com.my:80>
     ServerAdmin dev@dev.com
     DocumentRoot "C:/xampp/htdocs/brspace/www"
     ServerName brspace.bankrakyat.com.my
     ServerAlias brspace.bankrakyat.com.my
     ErrorLog "logs/brspace.local-error.log"
     CustomLog "logs/brspace.local-access.log" common
     DirectoryIndex index.php
    
     RewriteEngine On
     RewriteCond %{HTTPS} off
     RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}
    
    
     <Directory "C:/xampp/htdocs/htdocs/brspace/www">
         AllowOverride all
         Options FollowSymLinks MultiViews
         Require all granted
     </Directory>
     </VirtualHost>
    
  3. Add your HTTPS virtual host (port 443):

     <VirtualHost brspace.bankrakyat.com.my:443>
     ServerAdmin dev@dev.com
     DocumentRoot "C:/xampp/htdocs/brspace/www"
     ServerName brspace.bankrakyat.com.my
     ServerAlias brspace.bankrakyat.com.my
     ErrorLog "logs/brspacessl.local-error.log"
     CustomLog "logs/brspacessl.local-access.log" common
     DirectoryIndex index.php
    
     <Directory "C:/xampp/htdocs/htdocs/brspace/www">
         AllowOverride all
         Options FollowSymLinks MultiViews
         Require all granted
     </Directory>
    
     # SSL Engine Switch:
     SSLEngine on
     SSLCertificateFile C:\xampp\apache\conf\ssl\bundle.brspace.bankrakyat.com.my.crt
     SSLCertificateKeyFile C:\xampp\apache\conf\ssl\new.brspace.bankrakyat.com.my.key
    
     </VirtualHost>
    

Step 6: Enable Virtual Hosts

  1. Open C:\xampp\apache\conf\httpd.conf
  2. Find and uncomment:
    Include conf/extra/httpd-vhosts.conf
    

Step 7: Enable Rewrite Module (for HTTP to HTTPS redirect)

In C:\xampp\apache\conf\httpd.conf, uncomment:

LoadModule rewrite_module modules/mod_rewrite.so

Testing and Verification

Step 8: Test Configuration

  1. Open Command Prompt as Administrator
  2. Navigate to C:\xampp\apache\bin\
  3. Test Apache configuration:
    httpd.exe -t
    
    You should see "Syntax OK"

Step 9: Restart Apache

  1. In XAMPP Control Panel, start Apache
  2. Check for any error messages in the control panel

Step 10: Verify SSL Certificate

  1. Open your browser and navigate to https://brspace.bankrakyat.com.my
  2. Check that:
    • The site loads without SSL warnings
    • The padlock icon appears in the address bar
    • HTTP automatically redirects to HTTPS

Step 11: Online SSL Testing

Use online tools to verify your SSL installation:

Troubleshooting

Common Issues and Solutions

Issue 1: "Cannot load SSL certificate"

Solution:

Issue 2: "SSL handshake failed"

Solution:

Issue 3: "Certificate chain incomplete"

Solution:

Issue 4: Mixed content warnings

Solution:

Log File Locations

Useful Commands

# Test Apache configuration
C:\xampp\apache\bin\httpd.exe -t

# View loaded modules
C:\xampp\apache\bin\httpd.exe -M

# Check SSL certificate details
openssl x509 -in your-domain.crt -text -noout

Security Best Practices

  1. Keep certificates secure: Store certificate files in a protected directory
  2. Regular updates: Keep XAMPP and Apache updated
  3. Strong SSL configuration: Use modern protocols and ciphers only
  4. HSTS headers: Implement HTTP Strict Transport Security
  5. Regular certificate renewal: Monitor certificate expiration dates
  6. Backup certificates: Keep secure backups of your certificate files

This manual provides a complete guide for setting up SSL certificates with virtual hosts on XAMPP Apache in a Windows Server environment. Follow each step carefully and test thoroughly before deploying to production.


Revision #3
Created 26 August 2025 06:28:14 by Admin
Updated 26 August 2025 08:11:20 by Admin