Quantcast
Channel: Windows Server Archives - TechDirectArchive
Viewing all articles
Browse latest Browse all 61

How to configure SSL for WAMP server

$
0
0
SSL for Localhost on WAMP

The WAMP server (Windows, Apache, MySQL, PHP/Python/Perl) is a software stack designed to create a local development environment on Windows. It bundles “Apache”, a web server to host websites and applications, “MySQL”: A”, a relational database management system for managing data, and “PHP/Python/Perl”, a programming languages for server-side scripting. In this short article, we shall discuss how to configure SSL for WAMP server. Please see how to Install and Configure WordPress on Your Windows Computer Using WAMP SERVER, and how to Generate self-signed certificate and export in PFX format via PowerShell [Part 2].

Please see Install Let’s Encrypt Wildcard SSL Certificate in cPanel using Certify The Web, and How to import SSL Certificate to Windows Server using DigiCert Utility. Also, see How to generate your trial SSL Certificate using DigiCert PKI platform.

What Certificate Format?

A WAMP server certificate can be in either PEM or PKCS12 format. PEM (Privacy Enhanced Mail) format is a base64 encoded ASCII format for certificates. PKCS12 (Public Key Cryptography Standard 12) format is a binary format that can contain both the certificate and its private key, protected by a password.

Note: Windows servers use .pfx files that contain the public key file (SSL certificate file) and the associated private key file. So, if transferring your SSL certificates from a Windows server to Apache, you need to export the certificate in an Apache-compatible format, which splits the public (.crt) and private (.key) files.

Apache servers split the SSL certificate parts into two separate files: .crt and .key files. The .crt file contains the public key file (SSL certificate file), and the .key file contains the associated private key.

Some SSL authorities (CAs) provides you with an SSL certificate (public key file). You must use your server to generate the associated private key file as part of the CSR. You need both the public and private keys for an SSL certificate to function. These certificate authorities issue SSL/TLS certificates that enable secure communication and help establish trust for websites.

Please see How to Disable TLS 1.0, TLS 1.1 and TLS 1.2 in Windows Using GPO, how to Install Lets Encrypt Certificate on Windows with Certbot, and how to Generate a self-signed SSL certificate: Enable LDAP over SSL.

Configure SSL for WAMP

You can configure SSL (Secure Sockets Layer) for a WAMP server by creating a self-signed SSL certificate or using a third-party certificate. To enable HTTPS, set up the SSL certificate and configure Apache accordingly.

Please see how to fix Apache errors associated with WAMP installation for TeamPass, Setup VirtualHost with SSL on WAMP Server, and How to create Virtual Hosts in a WAMPserver.

Enable SSL Module in Apache

Launch the WAMP server menu by clicking on the WAMP icon in the system tray. Navigate to Apache> Apache Modules and make sure that ssl_module is checked. If it’s not checked, click on it to enable.

Also, do not forget to enable the rewrite_module.

Create a Self-Signed SSL Certificate

Since this is for testing purpose, launch the Command Prompt with administrator privileges. Navigate to the Apache bin directory in your WAMP installation as shown below.

cd C:\wamp\bin\apache\apache2.4.41\bin

Next, generate a private key and a self-signed certificate. Please see How to Install OpenSSL on Windows Computers

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout private.key -out certificate.crt

Follow the prompts to enter the required information. Please see “MBAM extended support ends April 2026: Find alternative solution, and how to fix “You are currently signed in as: Use a different account-this account is managed by your organisation”.

Configure Apache to Use SSL

Open the Apache configuration file httpd.conf in a text editor. You can find it in the Apache conf directory as shown below and uncomment “include conf/extra/https-ssl.conf and save. This enables Apache to load the SSL-specific configuration from the httpd-ssl.conf file, which contains the directives required to handle HTTPS connections. Without this, the server won’t recognize or respond to HTTPS requests.

C:\wamp\bin\apache\apache2.4.41\conf\httpd.conf

Configure Apache for SSL

Open the httpd-ssl.conf file in a text editor as shown below.

Modify or ensure the following configurations are available. To do this, please update the SSLCertificateFile and SSLCertificateKeyFile directives to point to your generated certificate and key:

SSLCertificateFile "${SRVROOT}/conf/ssl/server.crt"
SSLCertificateKeyFile "${SRVROOT}/conf/ssl/server.key"

I prefer to have it set this way below due to several errors I encountered.

SSLCertificateFile "C:/wamp/bin/apache/apache2.4.41/conf/ssl/techda.crt"
SSLCertificateKeyFile "C:/wamp/bin/apache/apache2.4.41/conf/ssl/techda.key"

Set the virtual host details for your domain

Also, do not forget to set the virtual host details for your local domain. This article is similar to the topic Configure a virtual host for SSL on WAMP Server, other than it was not specifically for accessing localhost securely.

Define a new virtual host for your SSL-enabled website with the following parameters as shown below.

DocumentRoot "${SRVROOT}/www/htdocs"
ServerName techapp.com:443
ServerAdmin contact@techdirectarchive.com

<Please uncomment and specify the following certificate path into the "SSLCertificateKeyFile", and the "SSLCertificateFile">
SSLEngine on
SSLCertificateKeyFile "C:/wamp64/bin/apache/apache2.4.54.2/conf/key/techda.crt"
SSLCertificateFile "C:/wamp64/bin/apache/apache2.4.54.2/conf/key/techda.key"

Restart Server and Test SSL Certificate

Next, restart the Apache server through the WAMP server menu and test your SSL configuration. Afterwards, open your web browser and access your local server using https://localhost.

You might get a warning about the SSL certificate not being trusted since it’s self-signed. Proceed to the site (this varies depending on the browser).

Since (if) you are using a self-signed certificate. Your browser may display a warning. You can bypass it by marking the certificate as trusted for local use.

Now, your WAMP server should be accessible over HTTPS. Remember, while self-signed certificates are useful for development and testing, they are not suitable for production. In a production environment, obtain a certificate from a trusted Certificate Authority

I hope you found this article very useful on How to configure SSL for WAMP server. Please feel free to leave a comment below.

The post How to configure SSL for WAMP server appeared first on TechDirectArchive.


Viewing all articles
Browse latest Browse all 61

Trending Articles