Adding SSL support for signup and login to a Rails app
First, get an SSL Cert. In a quick search, GoDaddy seem to be one of the cheaper options at $29.99/year. Pick the ‘Standard SSL’ option.
Important: When prompted for a passphrase, just press enter. Otherwise you’ll have to enter it every time you start apache.
$ openssl genrsa -des3 -out clikboard.key 1024
$ openssl req -new -key clikboard.key -out clikboard.csr
On the GoDaddy site, click on the certificate you’ve just bought and you will be taken to a screen where you confirm the contact details and a place to host the certificate signing request. Paste the contents of clikboard.csr into this area. Click next and shortly afterwards you’ll receive an email with a link to the certificate zipfile (containing, in my case, 2 files – gd_bundle.crt and clikboard.com.crt). Copy these onto your production server.
On the server, edit /etc/apache2/sites-available/clikboard (replace this with your site config) to make a copy of the VirtualHost section and replace the :80 with :443 and add the following lines:
SSLEngine on
SSLCertificateFile /home/denis/ssl/clikboard.com.crt
SSLCertificateKeyFile /home/denis/ssl/clikboard.key
SSLCertificateChainFile /home/denis/ssl/gd_bundle.crt
Then, enable SSL and restart apache:
$ sudo a2enmod ssl
$ sudo /etc/init.d/apache2 force-reload
Verify that the site now works with both http and https urls. Of course, all this is apache stuff and really nothing to do with rails. The last part of getting it working with your rails app is actually trivial:
./plugin/install ssl_requirement
Then, follow the instructions in vendor/plugins/ssl_requirement/README.