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.

[youtube https://www.youtube.com/watch?v=TH6evGKgy20&w=560&h=315]

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


Path to openssl.exe : C:wampbinapacheapache2.4.9binopenssl.exe
Path to openssl.cnf : C:wampbinapacheapache2.4.9confopenssl.cnf

Step 5:

CMD in Path to openssl.exe :::

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:wampbinapacheapache2.4.9confopenssl.cnf

Now copy the privateKey & certificate into folder

Step 6:

Open httpd.conf & uncomment following

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 (wampbinphpphp5.5.12php.ini)

extension=php_openssl.dll

Step 7:


C:wampbinapacheapache x.x.xconfextrahttpd-ssl.conf
(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"
-------------------


httpd -t (To check the validity of file)

11 comments

  1. Jonathan Reply

    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 Reply

    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) ?

    • Ankit Wasankar Reply

      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.

  3. Sudhir gupta Reply

    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:wamp64binapacheapache2.4.23bin)

    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:wamp64scriptsconfig.inc.php (mine were located at lines 133 and 139).

    Thanks
    Sudhir K gupta
    Owner of comedymood.com

  4. Jessica Reply

    Dear Ankit, thank you for your support with this.

    In my case, I have the following error after doing all the procedure.
    When i try to check the validity, I get.
    Cannot load modules/mod_ssl.so into server: The operating system cannot run %1.

    Do you have an idea what can be?

  5. narayana Reply

    Ankit
    did not work form me.
    Did not fine this line in httpd conf:
    1.LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
    2. Apache does not start when i enable :
    Include conf/extra/httpd-ssl.conf in httpd conf
    Any idea.
    can you take a look at my files cofig files and advise me please;
    Thanks

Leave a Reply

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