Generating a Self-Signed SSL Certificate for WAMP on Windows 10/11

Image showing the process of generating a self-signed SSL certificate for WAMP on Windows 10/11 with encryption and server symbols.

Step 1: Install OpenSSL

  • Download OpenSSL: OpenSSL is a tool used to create SSL certificates. You can download it from OpenSSL’s official website.
  • Install OpenSSL: Run the installer and follow the on-screen instructions. Make sure to add OpenSSL to your system’s PATH during installation.

Step 2: Create a Self-Signed SSL Certificate

  • Open Command Prompt: Press Win + R, type cmd, and hit Enter to open the Command Prompt.
  • Navigate to OpenSSL Bin Directory: Use the cd command to navigate to the OpenSSL ‘bin’ directory. For example:
    cd C:\Program Files\OpenSSL-Win64\bin
  • Generate Private Key: Run the following command to create a private key:
    openssl genrsa -out localhost.key 2048
  • Generate Certificate Signing Request (CSR): Create a CSR using the private key:
    openssl req -new -key localhost.key -out localhost.csr
    You will be prompted to enter details like country, state, organization, etc. For ‘Common Name’, use ‘localhost’.
  • Generate Self-Signed Certificate: Use the CSR to create a self-signed certificate:
    openssl x509 -req -days 365 -in localhost.csr -signkey localhost.key -out localhost.crt

Step 3: Configuring WAMP to Use the SSL Certificate

  • Copy Certificate Files: Copy the localhost.key and localhost.crt files to the Apache directory in WAMP (e.g., C:\wamp64\bin\apache\apache2.4.41\conf).
  • Edit Apache Configuration:
    • Open the httpd.conf file located in the Apache directory.
    • Ensure that the SSL module is enabled (remove the # at the start of the line):
      LoadModule ssl_module modules/mod_ssl.so
    • Add the following lines at the end of the file to configure SSL:
      <VirtualHost *:443> DocumentRoot "c:/wamp64/www" ServerName localhost SSLEngine on SSLCertificateFile "conf/localhost.crt" SSLCertificateKeyFile "conf/localhost.key" </VirtualHost>
  • Restart WAMP: Restart WAMP to apply the changes.

Step 4: Accessing Your Site with HTTPS

  • Open Your Browser: Navigate to https://localhost. You might see a security warning because the certificate is self-signed. Proceed to access your site.

Conclusion:

By following these steps, you’ve successfully created a self-signed SSL certificate and configured WAMP to use it. This setup will allow you to run WordPress and other applications over HTTPS on your local Windows machine, providing a more realistic environment for development and testing.

Picture of admin

admin

Leave a Reply

Sign up for our Newsletter

Get the latest information on what is going on in the I.T. World.