對於服務器的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