Install SSL on windows localhost WAMP + SSL = HTTPS

Ankit Wasankar
3 min readDec 15, 2020

How to Install SSL on windows localhost WAMP HTTP & SSL HTTPS?

Lot many times our production servers are installed with SSL certificates and our local development machines uses normal 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.

If you are not able to convert WAMP server icon to green, you can check this video.

So here’s the guide how to install self signed SSL certificate on the local WAMP installation and use Https communication with your local WAMP.

File with all commands: Download

Video Guide — Install SSL on windows localhost WAMP HTTP & SSL HTTPS?

Setup Process:

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

Step by step SSL configuration:

Prerequisite:

  • Download & install WAMP (Assuming that WAMP is installed in C: drive)
  • Download & install OpenSSL

Steps to setup SSL with WAMP

  • Note down paths for “openssl.exe” and “openssl.cnf” in the notepad
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
  • Generate self-signed certificate and private key using open-ssl
cd C:\wamp\bin\apache\apache2.4.9\bin\   openssl genrsa -aes256 -out private.key 2048openssl rsa -in private.key -out private.keyopenssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -config C:\wamp\bin\apache\apache2.4.9\conf\openssl.cnf
  • Copy the generated certificate and private key into new folder (named “key”) and create this new folder in the same directory where openssl.cnf is present.
C:\wamp\bin\apache\apache2.4.9\conf\key\certificate.crt
C:\wamp\bin\apache\apache2.4.9\conf\key\private.key
  • Open “httpd.conf” and uncomment the following lines from “httpd.conf”
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” file and uncomment the following line
extension=php_openssl.dll
  • Edit “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"
-------------------
  • Finally check the validity of file using below command:
httpd -tOutput should be : Syntax Ok
  • Restart/Start the WAMP server and wait until turns Green or Orange
  • Then open https://localhost
  • You should see the pad lock and a warning for using self signed certificate. And That’s it. You have successfully installed the SSL in localhost WAMP server.
  • Click on “I accept the risk” and continue the work.
Screenshot: Showing the HTTPS connection working with self signed certificate.

Why I’m getting “Connection is untrusted”, how can remove it?

There is no way you can remove the error, this is browser’s default behavior.

You are getting this notification message at browser because the certificate is self signed certificate and not certified by any CA authority. Self-signed certificates aren’t trusted by browsers because they are generated by you, not by a Certificate Authorities.

How to create Self Signed Certificate for localhost (127.0.01) ?

As mentioned above in the step by step process, install the openssl program on your system and the note down the path for “openssl.exe” and “openssl.cnf” .

Then use following commands to generate self signed certificate:

  • Generate self-signed certificate and private key using open-ssl
cd C:\wamp\bin\apache\apache2.4.9\bin\openssl genrsa -aes256 -out private.key 2048openssl rsa -in private.key -out private.keyopenssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -config C:\wamp\bin\apache\apache2.4.9\conf\openssl.cnf
Screenshot: Showing the self-signed certificate generated using openssl

Have a good day!

Any questions or queries, let me know in comments ?

--

--