Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Ahtisham Hasan Khan
Ahtisham Hasan Khan

Posted on • Edited on

     

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 discussedhow 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 fromhere.

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 foundhere.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 directoryC:\wamp64\bin\apache\apache2.4.51\conf

  • Copy the generatedprivate.key andcertificate.crt files fromC:\Program Files\OpenSSL-Win64\bin
    to theC:\wamp64\bin\apache\apache2.4.27\conf\key folder.

Step 4: Edit Your httpd.conf File

  • Openc:/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

  • Openc:/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 modeExit fullscreen mode
  • The DocumentRoot folder is the location where the website files are located. The ServerName can be set aslocalhost" 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 toc:/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, considerbuying me Coffee ☕. Your support keeps me fueled to create more content!

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

"Learning the art of web crafting with JavaScript, frameworks, and a sprinkle of creativity. Let's grow together! 🌱🚀"
  • Location
    Karachi, Pakistan.
  • Work
    Software Engineer at OfficeField
  • Joined

More fromAhtisham Hasan Khan

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp