Install SSL on windows localhost WAMP HTTP & SSL HTTPS

Install SSL on windows localhost WAMP HTTP + SSL = HTTPS

Here we are going to see how to install SSL certificate in Windows localhost WAMP server.
Lot many times our production servers are installed with SSL certificates and our local development machines uses noramal http, and this makes our development system different from our production one. And as a developer we always like to have an exact environment like our production system. So here’s the guide how to install self created SSL certificate on your local WAMP installation and use Https communication with your local WAMP.

Here are the things we are going to do

  1. Download & install WAMP (Assuming that WAMP is installed in C: directory)
  2. Download & install OpenSSL
  3. Configure WAMP to use HTTP+SSL=HTTPS

Watch the video tutorial to know about the detailed step by step procedure.

Step 1:

Download & install WAMP (Assuming that WAMP is installed in C: directory)

Step 2:

Download & install OpenSSL

Step 3:

Configure WAMP to use HTTP+SSL=HTTPS

1
2
    Path to openssl.exe : C:\wamp\bin\apache\apache2.4.9\bin\openssl.exe
    Path to openssl.cnf : C:\wamp\bin\apache\apache2.4.9\conf\openssl.cnf

Step 5:

CMD in Path to openssl.exe :::

1
2
3
    openssl genrsa -aes256 -out private.key 2048
    openssl rsa -in private.key -out private.key
    openssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -config C:\wamp\bin\apache\apache2.4.9\conf\openssl.cnf

Now copy the privateKey & certificate into folder

Step 6:

Open httpd.conf & uncomment following

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

Open php.ini (wamp\bin\php\php5.5.12\php.ini)

1
extension=php_openssl.dll

Step 7:

1
2
3
4
5
6
7
8
9
10
11
12
    C:\wamp\bin\apache\apache x.x.x\conf\extra\httpd-ssl.conf
    <VirtualHost _default_:443> (Below this line check following parameters)
-------------------
    DocumentRoot "C:/wamp/www"
    ServerName localhost:443
    ServerAdmin admin@example.com
    ErrorLog "C:/wamp/bin/apache/apache2.4.9/logs/ssl_error.log"
    TransferLog "C:/wamp/bin/apache/apache2.4.9/logs/ssl_access.log"

    SSLCertificateFile "C:/wamp/bin/apache/apache2.4.9/conf/key/certificate.crt"
    SSLCertificateKeyFile "C:/wamp/bin/apache/apache2.4.9/conf/key/private.key"
-------------------
1
    httpd -t (To check the validity of file)

Follow Me

Ankit Wasankar

Programmer at Yardi India Pvt. Ltd.
Author Ankit Wasankar is a Programmer II at Yardi India Pvt. Ltd., loves writing about the personal experiences with new technologies, specially Python.
Follow Me

7 comments

  1. daoanhvu3389@gmail.com'
    Jonathan

    i got 403 problem with using virtual domain, i tried to modify httpd-ssl.conf with custom virtual domain as:
    # General setup for the virtual host
    DocumentRoot “D:/path to web root”
    ServerName dev.example.com:443

    I want access URL via HTTPS as : https://dev.example.com. Please help.

  2. abdulwahab.alghamdi@gmail.com'
    Abdulwahab

    Dear Ankit,
    First, thank you for your try to make this procedure easier. but in the article above you said “download and install OpenSSl” without mentioning that I have to download the compiler from “OpenSSL shining light production” not the original code of OpenSSL project.

    I spent my whole day trying to install the project until I watched the video and found where is the mistake.

    Please note that using a third-party compiler is not secured for production environment, that’s why you will not find a compiler in OpenSSL project.

    Now, How can I compile and install OpenSSL on windows 10 (the easy way) ?

  3. Ankit Wasankar Post author

    Hello.
    Thanks for pointing out the security risk. As I have mentioned, I used these compilers just for the localhost. As in production we already have certificate or the bundle ready to use. Still I would look into the better way to make it on localhost. Thanks again.

  4. sudhirgupta.456@gmail.com'
    Sudhir gupta

    when i tried the same.. i found one issue “the ordinal 371 could not be located in the dynamic link library”
    after hours of struggling i found this working solution for me.

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    To fix the issue, two things are needed:

    1) Make sure that you don’t have symbolic links for libeay32.dll and ssleay32.dll in your Apache bin directory (For example, mine is: C:\wamp64\bin\apache\apache2.4.23\bin)

    If you do have symbolic links (i.e. the file size are 0 bytes), you need to download the dlls from Apache Lounge. For example, I grabbed the two .dll files from the 64-bit version of Apache 2.4.23 hosted at https://www.apachelounge.com/download/

    2) Once you have the actual .dll files restored, you need to make sure that WampServer isn’t overwriting them. WampServer 3 has a configuration script that runs every time it starts. In that script it will overwrite those .dlls with symbolic links. You must DISABLE that functionality. To do so, comment out the references to those two files in: C:\wamp64\scripts\config.inc.php (mine were located at lines 133 and 139).

    Thanks
    Sudhir K gupta
    Owner of comedymood.com

Leave a Reply

Your email address will not be published. Required fields are marked *