DEV Community

Ahtisham Hasan Khan
Ahtisham Hasan Khan

Posted on • Edited on

1

How to enable HTTPS for WAMP Server.

Securing your web applications with HTTPS is a fundamental aspect of web development. In a previous article, we discussed how to enable HTTPS on XAMPP. Now, we'll focus on achieving the same security on WAMP, a widely used web development environment. Let's dive into the process of enabling HTTPS on WAMP for a more secure web experience.

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 2: 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 3: 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 4: 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 5: 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"
Enter fullscreen mode Exit fullscreen mode
  • 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 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.

Public Gist URL: https://gist.github.com/iahtisham/5268b2391c674d758d0c2030dfbdb882

If you found this post helpful, consider buying me Coffee ☕. Your support keeps me fueled to create more content!

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay