Rails 3.0 SSl for passenger on Ubuntu Natty
I was wondering how to go about setting up ssl for a Rails 3.0 for passenger on Ubuntu Natty.
I have a rails book for 2.x, and it explains, as far as the app is concerned, that I need to install the plugin ssl_requirement. Then in my controllers use ssl_required for the specific actions I want to encrypt. Is that still the same for rails 3.0?
Does any anyone know how to set up passenger to use ssl. From what I've seen it goes in my vhost configuration.
Appreciate any help.
Thank you,
Bria开发者_运维知识库n
Alright, here's the deal. I purchased my ssl certificate through godaddy. Here's the steps I followed. I hope this helps someone because this was a pain.
- pull up ssh
- run openssl req -new -newkey rsa:2048 -nodes -keyout mykey.pem -out myreq.pem
- download using sftp mykey.pem and myreq.pem from the directory you ran the previous command from
- go to godaddy and enter the contents of myreq
- download your certificates
- place your certs in /ect/ssl/certs
- place your private key mykey.pem into /ect/ssl/private
configure your vhost in /etc/apache2/sites-available/somesite for example:
<VirtualHost *:80> ServerName somesite.com ServerAlias www.somesite.com DocumentRoot /root/public_html/somesite/public </VirtualHost> <VirtualHost somesite.com:443> DocumentRoot /root/public_html/somesite/public ServerName somesite.com ServerAlias www.somesite.com SSLEngine on SSLCertificateFile /etc/ssl/certs/somesite.com.crt SSLCertificateKeyFile /etc/ssl/private/mykey.pem SSLCertificateChainFile /etc/ssl/certs/gd_bundle.crt </VirtualHost>
- enable ssh: a2enmod ssl
- restart server: sudo /etc/init.d/apache2 restart
- now if I haven't missed anything (it's 3 am) you should be able to pull up your site and enter https
- go to: https://github.com/tobmatth/rack-ssl-enforcer
- follow the steps there (I set it up so my whole app is https because I couldn't get it to work for individual actions)
I hope this helps. I'll look at this again when I wake up to make sure I didn't miss anything.
精彩评论