Install Ssl On Wamp Server

To request a SSL certificate from public trusted CA (Certificate Authorities), you’ll need to follow below steps:

Create CSR and Private key from the server:

Requesting SSL certificate from certificate authority (CA) requires you to create a CSR (Certificate Signing Request) and Private key from the server where domain is being hosted. CSR will be then submitted to your order portal to get the certificate and private key will be required later to install SSL certificate once issued.

You will be required to install OpenSSL from here, to create CSR and private key from the server. Once OpenSSL gets installed (often comes preinstalled on Linux environment), then you can execute below commands to get CSR and private key:

openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key

  • Common name should be your domain/subdomain name for which you are requesting SSL certificate. For wildcard certificates, common name should be in *.domainname.com format.
  • Passphrase, optional company name should be kept blank while generating CSR-key.

Important: Please be careful while handling the private key. Its most confidential part of the SSL certificate and should remain at your server end only. Neither certificate issuance authority nor the SSL provider stores private key related information. Exposing private key to unknown sources may result in revocation of the certificate after issuance.

Once you have saved the private key in safe location, use the CSR code to configure the order from your SSL order portal. Once order is configured and you have completed all necessary validation process, certificate authority (CA) will issue the SSL certificate to you.

SSL Installation on WAMP server:

  1. Once your certificate issued and you have downloaded the certificate files, open them with your preferred text editor (i.e. notepad) and merge them into a single file. Ensure the primary certificate is placed first, followed by the intermediate certificate and root certificate. Including an intermediate & root certificate helps prevent security warnings on your website, adheres to best SSL practices, and enhances your site’s security.

    Files should be arranged in below order one after another:

    yourdomainname.crt >> Intermediate.crt >> Root.crt

    Then this merged file can be named as certificate.crt

  2. After merging the certificate files, create a folder named “ssl” at the below specified path:

    “C:wampbinapacheapache2.4.51confssl”

  3. Copy your combined certificate file (certificate.crt) and your private key (.key file which was generated during CSR process and saved at your end) into the folder (C:wampbinapacheapache2.4.51confssl).

    *Ensure you replace “C:” with the drive where you installed WAMP if it is not in the default location.

  4. Wamp servers are often known for testing the site/application on local environment due to its limitation on handling huge traffic. So, if your website is hosted locally, follow below steps to access the domain on local server.

    • Open notepad as administrator.
    • Edit C:WindowsSystem32driversetchosts (the file has no extension)
    • Add below line at the bottom of hosts file:

      127.0.0.1 yourdomainname.com

      This command points Localhost to http://yourdomain.com locally and displays the default WAMP Dashboard Page.

      WAMP Server

      *If your domain is globally accessible (and not hosted locally) then the step 4 can be skipped. You need to manage domain mapping with its IP on your dns manager (Zone Editor).

  5. Configure the main Apache and SSL Configuration files:

    • Open httpd.conf located in “C:wamp64binapacheapache-(version)confhttpd.conf (based on where you installed WAMP) Now, uncomment the following 3 lines: –

      LoadModule ssl_module modules/mod_ssl.so
      Include conf/extra/httpd-ssl.conf
      LoadModule socache_shmcb_module modules/mod_socache_shmcb.so

    • Open httpd-ssl.conf located in “C:wamp64binapacheapache-(version)confextrashttpd-ssl.conf (based on where you installed WAMP) Change the following lines: –

      DocumentRoot "${INSTALL_DIR}/www"
      ServerName localhost:443
      ServerAdmin admin@example.com
      SSLCertificateKeyFile "${SRVROOT}/conf/ssl/private.key"
      SSLCertificateFile "${SRVROOT}/conf/ssl/certificate.crt"

      Furthermore, make sure that the following all lines are the same. If not, make sure to change them.

      SSLSessionCache "shmcb:${SRVROOT}/logs/ssl_scache(512000)"
      CustomLog "${SRVROOT}/logs/ssl_request.log"
      "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b"

  6. Configure the Apache Virtual Host:

    Open C:wamp64binapacheapache-(version)confextrahttpd-vhosts.conf (or the corresponding path based on where you installed WAMP). Ensure you make the following changes:

    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    DocumentRoot "${INSTALL_DIR}/www"
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
    SSLEngine on
    SSLCertificateFile "${SRVROOT}/conf/ssl/certificate.crt"
    SSLCertificateKeyFile "${SRVROOT}/conf/ssl/private.key"

    Verify that the paths to the certificate and the private key match their exact locations.

  7. Restart Apache WebServer:

    Restart all services through the WAMP Control Panel to restart your server and apply all changes. That’s it! You should now have successfully installed an SSL Certificate on WAMP. Visit https://yourdomain.com:443 to verify your secure connection.