2012年12月2日 星期日

Generate and install Self Signed SSL Certificate for XAMPP


Step 1: Generate a Private Key
C:\xampp\apache\bin>openssl genrsa -des3 -out server.key 1024 

Step 2: Generate a CSR
C:\xampp\apache\bin>openssl req -new -key server.key -config “C:\xampp\php\extras\openssl\openssl.cnf” -out server.csr

Step 3: Remove Passphrase from Key
C:\xampp\apache\bin>copy server.key server.key.org
C:\xampp\apache\bin>openssl rsa -in server.key.org -out server.key

Step 4: Generating a Self-Signed Certificate
C:\xampp\apache\bin>openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt 

Step 5: Installing the Private Key and Certificate

C:\xampp\apache\bin>copy server.crt c:\xampp\apache\conf\ssl.crt
C:\xampp\apache\bin>copy server.key c:\xampp\apache\conf\ssl.key

or configure the setting

<VirtualHost ssltest.com:443>
    DocumentRoot "path/to/ssltest.com"
    ServerName ssltest.com
    ServerAlias www.ssltest.com
    ServerAdmin you@ssltest.com
 
    SSLEngine on
 
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW
    :+SSLv2:+EXP:+eNULL
 
    SSLCertificateFile "path/to/server.crt"
 
    SSLCertificateKeyFile "path/to/server.key"
 
    <FilesMatch "\.(cgi|shtml|phtml|php|php5|php4|php3?)$">
       SSLOptions +StdEnvVars
    </FilesMatch>
 
    <Directory "path/to/cgi-bin">
       SSLOptions +StdEnvVars
   </Directory>
    SetEnvIf User-Agent ".*MSIE.*" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
</VirtualHost>



Step 6: Restart Apache and Test

沒有留言:

張貼留言