Quick and dirty self-signed certificate in Apache

In terminal, type:

cd /usr/local/apache2/conf/
openssl genrsa -out server.key 2048
openssl rsa -in server.key -out server.pem
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 3600 -in server.csr -signkey server.key -out server.crt -sha1

Modify conf/extra/httpd-ssl.conf:

SSLCertificateKeyFile /usr/local/apache2/conf/server.pem

In httpd.conf, uncomment:

Include conf/extra/httpd-ssl.conf