Enable SSL on Apache-2.2

This is recorded on CentOS-5, Apache-2.2.3. Also, reference my notes on enabling ssl on apache 2.0.63.

Install httpd and mod_ssl:
root# yum install httpd mod_ssl
root# mkdir /etc/httpd/ssl
root# cd /etc/httpd/ssl
root# vi openssl.cnf

Here you can enter your content of openssl.cnf, and then generate a private key:
root# openssl genrsa -des3 -out server.key 1024

Remove the passphrase on the private key, which makes apache not able to auto-restart:
root# cp server.key server.key.orig
root# openssl rsa -in server.key.orig -out server.key

Generate the CSR:
root# openssl req -new -key server.key -out server.csr

Now send your server.csr to your CA for signing. Placed the signed certificate in this directory as server.crt. If you get an CA chain file, place it here as ca-chain.crt.

Now edit the file /etc/httpd/conf.d/ssl.conf, and make sure the propterties SSLCertificateFile, SSLCertificateKeyFile are enabled and point to the proper file. If you have ssl.crt/ca.crt, then make sure SSLCertificateChainFile is enabled to point to the proper file path.

If you use virtual host, then in each <VirtualHost> section for port 443, make sure you have

    SSLEngine on
    SSLCertificateKeyFile /etc/httpd/ssl/server.key
    SSLCertificateFile /etc/httpd/ssl/server.crt
    SSLCertificateChainFile /etc/httpd/ssl/ca-chain.crt

Then you should be able to start or restart httpd.