Generating the private key:
openssl genrsa -des3 -out server.key 1024
Generating the CSR (certificate signing request):
openssl req -new -key server.key -out server.csr
Generating the self signed certificate:
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Configuring SSL in httpd.conf for Apache:
SSLEngine on
SSLCertificateFile /path/to/generated/server.crt
SSLCertificateKeyFile /path/to/generated/server.key
(replace path appropriately with the path to your certificate and key)
Restart Apache:
apachectl restartApache will ask you for the passphrase to your key. If you think you will be shutting the server down a lot, you may want to remove the passphrase from the key so you can avoid entering it each time. If not, don't worry about it. If so, complete this step after step 2 (Generating the CSR):
cp server.key server.key.copyopenssl rsa -in server.key.copy -out server.key
http://superuser.com/questions/73979/how-to-easily-create-a-ssl-certificate-and-configure-it-in-apache2-in-mac-os-x