Skip to content

Automatically installs SSL certificates for XAMPP on Windows. Supports both self-signed certificates and trusted Let's Encrypt certificates with intelligent webroot detection and VirtualHost configuration handling.

Notifications You must be signed in to change notification settings

CwmByte/XAMPP-SSL-Installer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

XAMPP Auto SSL Installer

by CwmByte.com

Automatically installs SSL certificates for XAMPP on Windows. Supports both self-signed certificates and trusted Let's Encrypt certificates with intelligent webroot detection and VirtualHost configuration handling.

Features

  • Smart Webroot Detection: Automatically detects VirtualHost configurations and custom DocumentRoot paths
  • Let's Encrypt Support: Obtain trusted SSL certificates that work without browser warnings
  • Self-Signed Certificates: Generate certificates instantly for local development
  • VirtualHost Conflict Resolution: Handles SSL configuration conflicts automatically
  • Auto-Renewal Setup: Creates renewal scripts for Let's Encrypt certificates
  • Comprehensive Validation: Tests Apache configuration and SSL connectivity
  • Professional Output: Clear progress indicators and detailed summaries

Requirements

  • Windows operating system
  • XAMPP installed (any recent version)
  • Administrator privileges
  • Python 3.6 or higher
  • Internet connection (for Let's Encrypt certificates)

Required Python Packages

The script requires the following Python packages:

  • psutil - For process management
  • requests - For HTTP requests and connectivity testing

Installation

  1. Install Required Packages

    pip install psutil requests

    Or install all requirements at once:

    pip install psutil requests certbot

    Note: certbot will be automatically installed by the script if needed, but you can pre-install it if desired.

  2. Download the Script

  3. Run the Script

    • Right-click the file and select "Run as administrator"
    • Follow the interactive prompts

Alternative Installation Methods

Using pip from Command Prompt (as Administrator):

# Open Command Prompt as Administrator
pip install psutil requests

# Then run the script
python xampp-ssl-installer.py

If pip is not in PATH:

# Use Python module syntax
python -m pip install psutil requests

For Python 3 specifically:

pip3 install psutil requests

Usage

Basic Usage

  1. Run as Administrator (required for XAMPP configuration changes)
  2. Enter your domain name when prompted
  3. Choose certificate type:
    • Option 1: Self-signed certificate (instant, browser warnings)
    • Option 2: Let's Encrypt certificate (trusted, requires public domain)
  4. Follow the prompts - the script handles everything automatically

Certificate Types

Self-Signed Certificates:

  • ✅ Works immediately
  • ✅ Perfect for local development
  • ⚠️ Browser security warnings
  • ⚠️ Not suitable for production

Let's Encrypt Certificates:

  • ✅ Trusted by all browsers
  • ✅ No security warnings
  • ✅ SEO and security benefits
  • ✅ Auto-renewable (90 days)
  • ⚠️ Requires public domain pointing to your server
  • ⚠️ Port 80 must be accessible from internet

Example Output

============================================================
XAMPP Auto SSL Installer by CwmByte.com
Automatically installs SSL certificates for XAMPP
Supports Let's Encrypt and self-signed certificates
============================================================

Found XAMPP installation at: C:\xampp
Checking running processes...
Apache is RUNNING:
  • httpd.exe (PID: 12345)
  • httpd.exe (PID: 12346)
   -> Will need restart after SSL setup
XAMPP Control Panel is RUNNING:
  • xampp-control.exe (PID: 12347)

Enter domain name (default: localhost): example.com

Certificate Options:
1. Self-signed certificate (works immediately, browser warnings)
2. Let's Encrypt certificate (trusted by browsers, requires public domain)

Choose certificate type (1/2): 2

Let's Encrypt Certificate Setup for example.com
Requirements:
   • Domain example.com must point to this server's public IP
   • Port 80 must be accessible from the internet
   • Apache must be running to serve the HTTP-01 challenge
   • Valid email address for Let's Encrypt account

Continue with Let's Encrypt? (y/n): y

Getting Let's Encrypt certificate for: example.com
   Domain example.com resolves to: 203.0.113.10
   Domain is publicly accessible
   Certbot is already installed

Analyzing webroot configuration...

Webroot Analysis for example.com:
========================================
✓ VirtualHost configuration detected
⚠ Domain serves from: C:/xampp/htdocs/example.com
  (not default htdocs)

Detected Issues:
  • VirtualHost serves from custom directory: C:/xampp/htdocs/example.com

Recommendations:
  • Let's Encrypt challenge must use VirtualHost webroot

Webroot Configuration Options:
========================================
Your domain uses a custom document root in VirtualHost configuration.
For Let's Encrypt to work, challenge files must be placed in the correct location.

Options:
1. Use VirtualHost webroot: C:/xampp/htdocs/example.com
2. Use default webroot: C:\xampp\htdocs
3. Let me configure this automatically (recommended)

Choose option (1/2/3): 1

Using webroot: C:/xampp/htdocs/example.com

Checking VirtualHost configuration for SSL conflicts...
   No SSL VirtualHost conflicts found
   No SSL conflicts
Testing Apache configuration...
   Apache configuration test passed
Checking running processes...
   Stopping Apache to restart without SSL conflicts...
Stopping Apache processes...
   Stopping httpd.exe (PID: 12345)
   Stopping httpd.exe (PID: 12346)
   Waiting for processes to stop...
   Starting Apache for Let's Encrypt challenge...
Starting Apache (HTTP only)...

Testing webroot accessibility...
  Testing webroot accessibility: http://example.com/.well-known/acme-challenge/test-accessibility
  ✓ Webroot is accessible via HTTP
   Enter email address for Let's Encrypt account: admin@example.com
   Requesting certificate from Let's Encrypt for example.com...
   Using webroot: C:/xampp/htdocs/example.com
   This may take a few minutes...
   Let's Encrypt certificate obtained successfully!
   Found certificates in: C:\Certbot\live\example.com
Let's Encrypt certificate obtained successfully
   Copied certificate to C:\xampp\apache\conf\ssl.crt\example.com.crt
   Copied private key to C:\xampp\apache\conf\ssl.key\example.com.key
Certificates copied successfully

Setting up automatic certificate renewal...
Enter email for renewal notifications (optional): admin@example.com
   Created renewal script: C:\xampp\ssl_renew_example_com.bat
Auto-renewal script created
   Certificate: C:\xampp\apache\conf\ssl.crt\example.com.crt
   Private Key: C:\xampp\apache\conf\ssl.key\example.com.key
Configuring Apache SSL settings...
   Backed up httpd.conf to httpd.conf.backup_20241201_143022
   Backed up httpd-ssl.conf to httpd-ssl.conf.backup_20241201_143022
   Enabled SSL module and configuration
   Updated SSL certificate paths

Restoring SSL VirtualHost configurations...
   No SSL VirtualHosts to restore
   No SSL VirtualHosts to restore

Testing final Apache configuration...
Testing Apache configuration...
   Apache configuration test passed
   Configuration OK
Checking running processes...

Apache needs restart to load new SSL certificate and configuration
Restart Apache now? (y/n): y
Restarting Apache...
Stopping Apache processes...
   Apache stopped successfully
Starting Apache with SSL support...
   Apache started successfully
   Testing SSL connection to https://example.com...
   SSL connection successful!

======================================================================
SSL Certificate Installation Complete!
======================================================================
Domain: example.com
Certificate Type: Let's Encrypt (Trusted)
Certificate: C:\xampp\apache\conf\ssl.crt\example.com.crt
Private Key: C:\xampp\apache\conf\ssl.key\example.com.key
Valid for: 90 days (auto-renewable)

Access your site via: https://example.com
                     https://localhost (if configured)

Congratulations! Your site now has a trusted SSL certificate!
   - No browser security warnings
   - Trusted by all browsers and devices
   - SEO and security benefits
   - Certificate will auto-renew before expiration

Important Next Steps:
   • Set up the renewal script in Windows Task Scheduler
   • Run renewal weekly to ensure certificates stay current
   • Keep port 80 accessible for renewal challenges
   • Monitor your domain's DNS configuration

Production Tips:
   • Ensure your domain's DNS A record points to this server
   • Keep ports 80 and 443 accessible from the internet
   • Monitor certificate expiration dates
   • Regular backups of your certificate files
   • Test SSL configuration with online tools

Configuration Summary:
   XAMPP Path: C:\xampp
   Apache Config: C:\xampp\apache\conf\httpd.conf
   SSL Config: C:\xampp\apache\conf\extra\httpd-ssl.conf
   VirtualHost Config: C:\xampp\apache\conf\extra\httpd-vhosts.conf
   Document Root: C:\xampp\htdocs

Certificate Files:
   Certificate: C:\xampp\apache\conf\ssl.crt\example.com.crt
   Private Key: C:\xampp\apache\conf\ssl.key\example.com.key
   Let's Encrypt Original: Check C:\Certbot\live\example.com\

Tool by CwmByte.com - Free XAMPP SSL automation
For support and updates, visit: https://cwmbyte.com

Press Enter to exit...

Configuration Scenarios

Scenario 1: Default XAMPP Setup

  • Files served from C:\xampp\htdocs
  • No VirtualHost configuration
  • Script automatically uses default webroot

Scenario 2: VirtualHost with Custom DocumentRoot

  • Files served from custom directory (e.g., C:\xampp\htdocs\example.com)
  • VirtualHost configured in httpd-vhosts.conf
  • Script detects custom webroot automatically

Scenario 3: SSL VirtualHost Conflicts

  • Existing SSL VirtualHost references missing certificates
  • Script temporarily disables conflicting VirtualHosts
  • Restores configuration after certificate creation

Troubleshooting

Let's Encrypt Issues

Domain not accessible:

  • Ensure domain DNS points to your server's public IP
  • Check firewall allows port 80 inbound
  • Verify Apache is serving files correctly

Webroot not accessible:

  • Check VirtualHost DocumentRoot configuration
  • Ensure directory permissions allow file creation
  • Verify Apache can serve files from the webroot

Cloudflare/CDN Issues:

  • Temporarily disable proxy (gray cloud in Cloudflare)
  • Complete SSL setup, then re-enable proxy
  • Or use Cloudflare Origin Certificates instead

Self-Signed Certificate Issues

Browser warnings:

  • Normal behavior for self-signed certificates
  • Click "Advanced" and "Proceed to site"
  • Use for development/testing only

Apache won't start:

  • Check Apache error logs in C:\xampp\apache\logs\error.log
  • Verify certificate files exist and are readable
  • Test Apache configuration with -t flag

File Locations

Certificate Files:

  • Certificate: C:\xampp\apache\conf\ssl.crt\[domain].crt
  • Private Key: C:\xampp\apache\conf\ssl.key\[domain].key

Configuration Files:

  • Main Apache Config: C:\xampp\apache\conf\httpd.conf
  • SSL Config: C:\xampp\apache\conf\extra\httpd-ssl.conf
  • VirtualHost Config: C:\xampp\apache\conf\extra\httpd-vhosts.conf

Let's Encrypt Files:

  • Original Certificates: C:\Certbot\live\[domain]\
  • Renewal Configuration: C:\Certbot\renewal\

Advanced Usage

Auto-Renewal Setup

  1. Run the script and choose Let's Encrypt
  2. Provide email for renewal notifications
  3. Locate the generated renewal script: C:\xampp\ssl_renew_[domain].bat
  4. Set up Windows Task Scheduler:
    • Open Task Scheduler
    • Create Basic Task
    • Name: "SSL Certificate Renewal"
    • Trigger: Weekly
    • Action: Start a program
    • Program: Path to the renewal script
    • Run with highest privileges: Checked

Multiple Domains

Run the script multiple times for different domains:

# First domain
python xampp-ssl-installer.py
# Enter: example.com

# Second domain  
python xampp-ssl-installer.py
# Enter: shop.example.com

Command Line Options

The script is interactive by design, but you can automate responses:

echo localhost | python xampp-ssl-installer.py

Security Considerations

  • Always run as Administrator (required for configuration changes)
  • Keep certificate files secure and backed up
  • Monitor certificate expiration dates
  • Use strong passwords for any certificate stores
  • Regularly update the script from CwmByte.com

Support

For support, updates, and additional tools:

Website: https://cwmbyte.com
Documentation: Available on the website
Issues: Report via the website contact form

License

Free to use for personal and commercial projects.
Created by CwmByte.com

Changelog

v1.0 - Initial release with smart webroot detection and VirtualHost handling

  • Let's Encrypt integration
  • Self-signed certificate generation
  • Automatic Apache configuration
  • VirtualHost conflict resolution
  • Auto-renewal script generation

This tool is provided as-is. Always test in a development environment before using in production.

About

Automatically installs SSL certificates for XAMPP on Windows. Supports both self-signed certificates and trusted Let's Encrypt certificates with intelligent webroot detection and VirtualHost configuration handling.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages