Saturday, 13 August 2011

SSL setup on windows and zend

#1:

Go to command prompt and cd to /bin folder and execute the following commands.

Below is the trace of mine:

C:\Zend\Apache2\bin>openssl genrsa -des3 -rand file1:file2:file3:file4:file5 -out server.key 1024
Loading 'screen' into random state - done
0 semi-random bytes loaded
Generating RSA private key, 1024 bit long modulus
...++++++
..++++++
e is 65537 (0x10001)
Enter pass phrase for server.key:
Verifying - Enter pass phrase for server.key:
C:\Zend\Apache2\bin>openssl req -new -key server.key -config C:\Zend\Apache2\conf\openssl.cnf -out server.csr
Enter pass phrase for server.key:
Loading 'screen' into random state - done
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:IN
State or Province Name (full name) [Some-State]:TN
Locality Name (eg, city) []:chennai
Organization Name (eg, company) [Internet Widgits Pty Ltd]:MyCompany
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:myname
Email Address []:myname@email.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:admin
An optional company name []:mycompany

C:\Zend\Apache2\bin>openssl x509 -req -days 60 -in server.csr -signkey server.key -out server.crt
Loading 'screen' into random state - done
Signature ok
subject=/C=IN/ST=TN/L=chennai/O=mycompany/CN=myname/emailAddress=myname@email.com
Getting Private key
Enter pass phrase for server.key:

#2:
remove Passphrase:
========================

1. First, make a copy and backup your private key file (bin/server1.key). This file should have an extension of ".key".
2. execute below:
C:\Zend\Apache2\bin>openssl rsa -in server1.key -out server.key
Enter pass phrase for server1.key:
9052:error:28069065:lib(40):UI_set_result:result too small:.\crypto\ui\ui_lib.c:850:You must type in 4 to 511 character
Enter pass phrase for server1.key:
writing RSA key

3. Follow the steps in http://files.zend.com/help/Zend-Server-Community-Edition/appendix_f_-_loading_the_mod_ssl_odule.htm to enable SSL.
4. Copy server.key and server.crt to apache/conf/ folder.
5. Open your conf/extra/httpd-ssl.conf file and locate the directive "SSLPassPhraseDialog" and put ‘#' in front of it to comment out that line.
#3:
6. Add below virtualhost

SetEnv SITE_NAME mysite.com
DocumentRoot "C:\Zend\Apache2/htdocs/mysite.com/public"
ServerName mysite.com
SetEnv APPLICATION_ENV development

AllowOverride All
Order allow,deny
allow from all


SSLEngine on
SSLCertificateFile "C:\Zend\Apache2/conf/server.crt"
SSLCertificateKeyFile "C:\Zend\Apache2/conf/server.key"


#4 : Restart Apache and verify https://mysite.com


Good Luck.
Happy Setup :)



No comments:

Post a Comment