Skip to content

Instantly share code, notes, and snippets.

@iahtisham
Last active May 11, 2022 13:58
Show Gist options
  • Save iahtisham/5268b2391c674d758d0c2030dfbdb882 to your computer and use it in GitHub Desktop.
Save iahtisham/5268b2391c674d758d0c2030dfbdb882 to your computer and use it in GitHub Desktop.
How to enable HTTPS for WAMP Server.

Following are some easy steps to setup enviroment to use HTTPS on WAMP.

It is Important that you have already got WAMP installed, If not you can download WAMP from here.

After you've downloade and installed WAMP; the steps are as follows,

STEP 1: Download and Install OpenSSL.

Both 32 and 64-bit versions of OpenSSL are available. Make sure you're using the right installation for your Windows version. The most recent version of OpenSSL may be found here. When Installing OpenSSL leave all settings default.

STEP 1: Generate Private Key and SSL certficate.

  • Load Command Prompt as an Administrator from your start menu and run the commands below. To begin, navigate to the directory where OpenSSL was installed.

    cd c:/program files/openssl-win64/bin/

  • Generate your Private key by using follwing command.You will be asked for a passphrase. Make it anything you want just make sure you remember it for the next step.

    openssl genrsa -aes256 -out private.key 2048

    openssl rsa -in private.key -out private.key

  • Now, create your Certificate thorough following commad,You will be asked several questions on this step. You can put whatever you like or just hit enter to leave it at default.

    • The only one that really matters is Common Name (e.g. server FQDN) you will need to type “localhost” for this.

    openssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500

STEP 2: Move your KEY and Certificate.

  • Create a folder named "KEY" in the directory C:\wamp64\bin\apache\apache2.4.51\conf

  • Copy the generated private.key and certificate.crt files from C:\Program Files\OpenSSL-Win64\bin to the C:\wamp64\bin\apache\apache2.4.27\conf\key folder.

Step 5: Edit Your httpd.conf File

  • Open c:/wamp64/bin/apache/apache2.4.41/conf/httpd.conf and un-comment (remove the #) 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

Step 6: Edit Your httpd-ssl.conf File

  • Open c:/wamp64/bin/apache/apache2.4.41/conf/extra/httpd-ssl.conf and change all the parameters to the ones shown below.
 DocumentRoot "c:/wamp64/www"
 ServerName localhost:443
 ServerAdmin admin@example.com
 ErrorLog "${SRVROOT}/logs/error.log"
 TransferLog "${SRVROOT}/logs/access.log"
 SSLSessionCache "shmcb:${SRVROOT}/logs/ssl_scache(512000)"
 SSLCertificateFile "${SRVROOT}/conf/key/certificate.crt"
 SSLCertificateKeyFile "${SRVROOT}/conf/key/private.key"
 CustomLog "${SRVROOT}/logs/ssl_request.log"
  • 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 7: Restart WampServer

  • Everything should be set up now. Make sure you restart WampServer for the changes to take effect.

  • If there will be any syntax error, you can check it by navigating to c:/wamp64/bin/apache/apache2.4.41/bin in Command Prompt and run following command;

    httpd -t

You should now be able to access your website with HTTPS / SSL enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment