Note: this is really a how-to, w/o any in-depth explanation, just a note to myself.

Today, I needed to add SSL support to UMapper.com application running on my Slackware localhost. We use CA-signed certificates on our server, but for local box self-signed was quite enough (all I need is to be able to view development version of site via https). Here what I did:

1. Create private key:

$ openssl genrsa -out localhost.key 1024

2. Generate CSR (Certificate Signing Request):

$ openssl req -new -key localhost.key -out localhost.csr

3. Generate certificate:

$ openssl x509 -req -days 365 -in localhost.csr \
        -signkey localhost.key -out localhost.crt

4. Make sure SSL is enabled in httpd.conf:

# Following two should be uncommented
LoadModule ssl_module lib/httpd/modules/mod_ssl.so
Include /etc/httpd/extra/httpd-ssl.conf

5. Edit httpd-ssl.conf so that virtual host users your created certificate:

# locate and edit cert.details. Make sure localhost.crt and localhost.key
# are present (you either created them there or copied)
SSLCertificateFile "/etc/httpd/certs/localhost.crt"
SSLCertificateKeyFile "/etc/httpd/certs/localhost.key"

6. Restart apache:

$ apachectl restart

That’s it. Please note that browser would still generate exception (and it is a good thing, as otherwise certificates wouldn’t be that useful). All you need is to add your localhost as exception – since we really trust that details we provided during certificate creation are our own :)

P.S. If you are getting “[warn] _default_ VirtualHost overlap on port 443,
the first has precedence”, add NameVirtualHost *:443 into your httpd.conf

,