开发者

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.

  1. pull up ssh
  2. run openssl req -new -newkey rsa:2048 -nodes -keyout mykey.pem -out myreq.pem
  3. download using sftp mykey.pem and myreq.pem from the directory you ran the previous command from
  4. go to godaddy and enter the contents of myreq
  5. download your certificates
  6. place your certs in /ect/ssl/certs
  7. place your private key mykey.pem into /ect/ssl/private
  8. 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>
    
  9. enable ssh: a2enmod ssl
  10. restart server: sudo /etc/init.d/apache2 restart
  11. now if I haven't missed anything (it's 3 am) you should be able to pull up your site and enter https
  12. go to: https://github.com/tobmatth/rack-ssl-enforcer
  13. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜