How to install SSL on windows localhost (wamp)?

Posted by Damodar Bashyal on October 14, 2014

 

These are the steps I noted down when installing ssl on my localhost wamp installation. I am using windows 7 Professional 64-bit Operating system.

First of all download and install OpenSSL binary from http://slproweb.com/products/Win32OpenSSL.html, I installed http://slproweb.com/download/Win64OpenSSL_Light-0_9_8zb.exe.

Using command line generate private key which is 2048bits encryption.

C:\wamp\bin\apache\apache2.4.9\bin> openssl genrsa -aes256 -out private.key 2048

Installing openSSL on windows wamp server localhost

+ click here to enlarge

Enter pass phrase after you run previous command and re-verify pass phrase. e.g. 'password'

Remove the pass phrase by executing:

C:\wamp\bin\apache\apache2.4.9\bin> openssl rsa -in private.key -out private.key

Now we will generate self-signed certificate to use to certify the connection and to encrypt traffic. This certificate will be valid for 100 years, so replace 36500 by the number of the days the certificate is valid for. "certificate.crt" will be our certificate.

C:\wamp\bin\apache\apache2.4.9\bin> 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

Create folders 'key' and 'cert' at: C:\wamp\bin\apache\apache2.4.9\conf

Copy 'certificate.crt' to cert and 'private.key' to key folders respectively.

Uncomment "LoadModule ssl_module modules/mod_ssl.so", "Include conf/extra/httpd-ssl.conf" and "LoadModule socache_shmcb_module modules/mod_socache_shmcb.so" on your C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf file.

Uncomment "extension=php_openssl.dll" on your file C:\wamp\bin\php\php5.5.12\php.ini.

Open C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-ssl.conf and find "<VirtualHost _default_:443>" and below that line find and update below configuration according to your setup:

	#   General setup for the virtual host
	DocumentRoot "c:/_projects"
	ServerName localhost:443
	ServerAdmin [email protected]
	ErrorLog "C:/wamp/bin/apache/apache2.4.9/logs/ssl_error.log"
	TransferLog "C:/wamp/bin/apache/apache2.4.9/logs/ssl_access.log"
	# Server Certificate:
	SSLCertificateFile "C:/wamp/bin/apache/apache2.4.9/conf/cert/certificate.crt"
	#   Server Private Key:
	SSLCertificateKeyFile "C:/wamp/bin/apache/apache2.4.9/conf/key/private.key"

On the same file replace '<Directory "c:/Apache24/cgi-bin">' with '<Directory "c:/_projects">' and update customLog: CustomLog "C:/wamp/bin/apache/apache2.4.9/logs/ssl_request.log" \

On command line run "httpd -t" and make sure you get syntax OK.

Restart wamp and visit https://localhost you will get warning about not certified certificate. you need to accept warning and continue to start using https.

That's all, you now have local SSL successfully installed :)

My vhosts conf file for one of the project looks like this:

	<VirtualHost 127.0.0.1:443>
		SetEnv MAGE_IS_DEVELOPER_MODE "true"
		SetEnv	MAGE_RUN_CODE "dltrorgau"
		ServerName dltrorg.dev
		ServerAlias www.dltrorg.dev
		ServerAdmin [email protected]
		DocumentRoot "c:/_projects/dltrorg/trunk"
		SSLEngine On
		# Server Certificate:
		SSLCertificateFile "C:/wamp/bin/apache/apache2.4.9/conf/cert/certificate.crt"
		#   Server Private Key:
		SSLCertificateKeyFile "C:/wamp/bin/apache/apache2.4.9/conf/key/private.key"
		<Directory "c:/_projects/dltrorg/trunk">
			Options Indexes FollowSymLinks
			AllowOverride All
			Order Allow,Deny
			Allow from all
		</Directory>
	</VirtualHost>

Let me know if I need to modify anything. It seems to be working fine for me :)

Nandakumar posted on - Thursday 5th of February 2015 06:16:50 AM

Hi,

I have done everything u posted. I am getting the result as "syntax OK." But when i restart my apache it doesn't seems to work. When i revert my changes in httpd.conf everything works fine and great. I a have checked in apache log it shows nothing.How can i get to know about the issues if it occurs. Can u please help me regarding this issue ?

Thanks

Guy posted on - Tuesday 18th of August 2015 07:55:01 AM

Amazing! Work like magic!

Michel posted on - Wednesday 23rd of December 2015 06:13:53 AM

Worked just fine! Thanks!

Madhi posted on - Thursday 23rd of July 2015 01:21:10 AM

I followed all the given steps, but i'm getting error. (SSL Certificate error) what do i do now to configure SSL in local machine. Please anyone help me to configure

Vaseem Ansari posted on - Friday 24th of April 2015 08:18:35 AM

i followed the above procedure and it worked like a charm.
What is what is i want to run multiple sites in apache 2.4.9.

i have directories like
site1
site2
site3

i have added the entries in httpd.conf and httpd-ssl.conf but the url are not working properly.

i m trying url like this
www.site1.dev
www.site2.dev
www.site3.dev

all are redirecting to site1 directory. please let me know if there is any changes i need to make.

Austin posted on - Thursday 23rd of July 2015 01:21:10 AM

After executing httpd -t it gave me a syntax error saying it cant find server.crt

abdel posted on - Tuesday 21st of April 2015 07:41:04 AM

if u put in virtual hosts
SSLEngine On
wamp doesn't start!

Mathivanan posted on - Thursday 12th of January 2017 10:40:35 PM

Hi
I am using apache2.4.23 on wampserver for 32 bit. I did the all the steps on above but i am getting error in my local

error: "Cannot load modules/mod_ssl.so into server: The operating system cannot run %1" After executing " httpd -t " command

how can i resolve it please help.
 
not published on website


QR Code: How to install SSL on windows localhost (wamp)?