Friday, April 18, 2008

Apache + SSL

1.0 Download Apache SSL and Open SSL

Download Apache With SSL Support and OpenSSL

Extra both zip files into two different location, and replace all *.exe, *.dll, *.so files from Apache with OpenSSL support to your Apache local installation.

Download ssl.conf into APACHE_HOME/conf

Download openssl.cnf into your OpenSSL directory Also copy the files ssleay32.dll and libeay32.dll from the OpenSSL distribution directory to WINDOWS\System32 directory !!!

2.0 Create Certificate

Enter the following command
openssl req -config openssl.cnf -new -out my-server.csr
This creates a certificate signing request and a private key.

openssl rsa -in privkey.pem -out my-server.key
This removes the passphrase from the private key.

openssl x509 -in my-server.csr -out my-server.cert -req -signkey my-server.key
This creates a self-signed certificate.

Create an APACHE_HOME/conf/ssl directory and move my-server.key and my-server.cert into it.

3.0 Configure mod_ssl and Apache

Edit APACHE_HOME/conf/httpd.conf add the following line

LoadModule ssl_module modules/mod_ssl.so

# SSL
SSLMutex default
SSLRandomSeed startup builtin
SSLSessionCache none


SSLEngine On
SSLCertificateFile conf/ssl/my-server.cert
SSLCertificateKeyFile conf/ssl/my-server.key


You also need to modify APACHE_HOME/conf/ssl.conf to update DocumentRoot and ServerName

Restart your Apache server and you could test it on https://localhost/

For reference please go tohttp://www.thompsonbd.com/tutorials/apachessl.php and http://tud.at/programm/apache-ssl-win32-howto.php3

No comments: