Rails 3.2.11 SSL配置 [英] Rails 3.2.11 SSL Configuration

查看:146
本文介绍了Rails 3.2.11 SSL配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一些问题,让我的rails应用程序运行在https。我只是想缩小导致问题的可能性。



我想知道我是否缺少配置Rails应用程序本身的任何步骤(不是网络服务器):


  1. config / environments / production.rb



    取消注释此行: config.force_ssl = true



    来源: http://simonecarletti.com/blog / 2011/05 / configuration-rails-3-https-ssl /


  2. Devise宝石的其他配置



    config / environments / production.rb



    添加以下行:
    $ code
    config.to_prepare {Devise :: SessionsController.force_ssl}
    config.to_prepare {Devise :: RegistrationsController.force_ssl}
    config.to_prepare {Devise :: PasswordsController.force_ssl}

    资料来源: https://github.com/plataformatec/devise/wiki/How-To:-使用-SSL-%28HTTPS%29


有没有其他的步骤?目前,我在尝试点击我的服务器时看到此网页不可用消息,没有看到Web服务器或Rails应用程序的日志文件中有任何错误。



我从我的网络浏览器看到这个错误信息:错误代码:ERR_CONNECTION_REFUSED



谢谢

解决方案

因为在Rails应用程序本身的问题中的配置已经正确设置,没有其他步骤需要。 >

此问题与SSL证书未正确设置相关。


So I'm having some issues with getting my rails app to run on https. And I'm just trying to narrow down the possibilities with what is causing the issue.

I was wondering if I am missing any steps with configuring the Rails application itself (not the web server):

  1. In config/environments/production.rb

    Uncomment this line:config.force_ssl = true

    Source: http://simonecarletti.com/blog/2011/05/configuring-rails-3-https-ssl/

  2. Additional configuration for the Devise gem

    In config/environments/production.rb

    Add the following lines: config.to_prepare { Devise::SessionsController.force_ssl } config.to_prepare { Devise::RegistrationsController.force_ssl } config.to_prepare { Devise::PasswordsController.force_ssl } Source: https://github.com/plataformatec/devise/wiki/How-To:-Use-SSL-%28HTTPS%29

Is there any other steps I am missing? Currently I am seeing a 'This webpage is not available' message when trying to hit my server, not seeing any errors in the log files for the web server or Rails app.

I am seeing this error message though from my web browser: Error code: ERR_CONNECTION_REFUSED

Thanks

解决方案

As it turns out the configuration in the question for the Rails app itself was setup properly and there were no other steps required there.

The issue was related to the SSL cert not being setup correctly.

这篇关于Rails 3.2.11 SSL配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆