How to enable SSL on a WAMP Server? Security

Websites in development environment that uses a WAMP server sometimes requires https to be available for further development of the application/websites. To enable https on the development server, we need to enable SSL manually.

The following steps are to enable SSL on a WAMP server –

Step 1: Download and Install OpenSSL on the server.

OpenSSL is available in both 32 and 64 bit versions. You can download the OpenSSL software for windows from the link http://gnuwin32.sourceforge.net/packages/openssl.htm

Make sure you leave the installation to the default settings.

Step 2: Creation of SSL Private Key and Certificate

Once the software is installed, the next step is to create the private key and certificate.

  1. Open the Start Menu -> Right click on command prompt -> “Run as Administrator”
  2. Change the directory to the location where OpenSSL

cd C:\Program Files\openssl-win64/bin

  1. Creation of private key and setting up passphrase

opensslgenrsa -aes256 -out private.key 2048 #generating private key

opensslrsa -in private.key -out private.key #removing the pass phrase

  1. The next step is to create the certificate which involves answering a some questions. The common name should set as “localhost”

opensslreq -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 #creating the certificate

Step 3: Copy the created SSL Key and certificate

The next step is to create a folder called “key” in the location C:\wamp64\bin\apache2.4.41\conf\. Copy C:\Program Files\openssl-win64\bin\certificate.crt and private.key to the newly created folder called key (C:\wamp64\bin\apache2.4.41\conf\key).

Step 4: Edit the httpd.conf file

The next step after copying of the files is to edit the httpd.confffile. Open the file C:\wamp64\bin\apache\apache2.4.41\conf\httpd.conf and un-comment (remove #) from the following 3 lines –

LoadModulessl_module modules/mod_ssl.so

Include conf/extra/httpd-ssl.conf

LoadModulesocache_shmcb_module modules/mod_socache_shmcb.so

The next step is to confirm that the following line is un-commented in the “php.ini” file located in “C:\wamp64\bin\php\php7.0.10\php.ini”

extension=php_openssl.dll

Step 5: Edit the httpd-ssl.conf file

The next step is to edit the httpd-ssl.conf file located in C:\wamp64\bin\apache\apache2.4.71\conf\extra\httpd-ssl.conf. The existing parameters should be changed to the following

VirtualHost *:443>

DocumentRoot “c:/wamp64/www”

ServerName localhost:443

ServerAdmin [email protected]

ErrorLog “${SRVROOT}/logs/error.log”

TransferLog “${SRVROOT}/logs/access.log”

SSLCertificateFile “${SRVROOT}/conf/key/certificate.crt”

SSLCertificateKeyFile “${SRVROOT}/conf/key/private.key”

CustomLog “${SRVROOT}/logs/ssl_request.log”

</VirtualHost>

The DocumentRoot folder is the location where the website files are located. The ServerName can be set as “localhost” or the name set to access the website like “example.com”

Step 6: Restart the WAMP Server

The final setep in enabling SSL in WAMP server is to restart the WAMP server for the changes to take effect. A green WAMP icon indicates that everything is good. If the icon is orange, it means that there is problem with the syntax in the configuration.

Running the C:\wamp64\bin\apache\apache2.4.41\bin\httd-t in the command prompt will list the syntax errors if any.

Note: As the certificate we have created is a self-signed certificate, you will receive a security warning.

At Velan, our server support engineers can help you setup SSL on your WAMP server. For details, please visit https://www.velaninfo.com/mservices/managed-it-services

Credentials

Quick Connect With Us


    captcha
    reload