对于服务器的SSL证书配置发展添加以下代码脚本/轨文件,
module Rails
class Server < ::Rack::Server
def default_options
super.merge({
:Port => 3445,
:environment => (ENV['RAILS_ENV'] || "development").dup,
:daemonize => false,
:debugger => false,
:pid => File.expand_path("tmp/pids/server.pid"),
:config => File.expand_path("config.ru"),
:SSLEnable => true,
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
:SSLPrivateKey => OpenSSL::PKey::RSA.new(
File.open("/home/mohanraj/myCA/server_key.pem").read),
:SSLCertificate => OpenSSL::X509::Certificate.new(
File.open("/home/mohanraj/myCA/server_crt.pem").read),
:SSLCertName => [["CN", WEBrick::Utils::getservername]]
})
end
end
end
注意:请为ssl文件提供正确的路径。
请点击此链接重定向http://www.railway.at/2013/02/12/using-ssl-in-your-local-rails-environment/
的可能重复[你是如何处理的发展SSL?(http://stackoverflow.com/questions/2118685/how-do-you-handle-ssl-在开发中) – 2013-05-02 10:27:13