ruby-on-rails - Rails、Windows 和 HTTPS

标签 ruby-on-rails windows https eventmachine

我的目标是从标准 HTTP 服务器传递到更安全的 HTTPS 服务器。

我的设置是:Ruby 2.0.0p598、Rails 4.2.0、Thin 1.6.3、Windows 7-Pro-x64-SP1

我做了什么我尝试使用自签名证书启动服务器:

thin start --ssl --ssl-key-file ssl/server.key --ssl-cert-file ssl/server.crt

问题是什么:我收到以下错误:

terminate called after throwing an instance of 'std::runtime_error'
  what():  Encryption not available on this event-machine

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

我要问你的问题:你知道这是否是 Windows 上的一个普遍问题(因此我什至想不出能成功做到这一点)还是有办法让 thin 在 ssl 上工作 window ?

最佳答案

这是一个副本:Install OpenSSL with Ruby for eventmachine on Windows 7 x86

我将给出与那里相同的答案:

在 C:\OpenSSL 中使用 ruby​​installer-2.1.6.exe、DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe 和 OpenSSL(http://slproweb.com/download/Win32OpenSSL-1_0_2c.exe 或更高版本)

gem install eventmachine -- --with-ssl-dir=C:\OpenSSL

成功但随后以通常的方式使用 ssl 运行失败:

Encryption not available on this event-machine

您在上面看到了如何将参数传递给 native gem 设置,这应该对您有所帮助。我们仍然需要找到一组参数来正确地构建这个东西。

制作方法

checking for main() in -lssl... no

是...?

经过半天的挖掘,我已经修补了 eventmachine 以在 Windows 上正确搜索 ssl 库,因此在 gemfile 中使用下面的行,直到更改被合并:

gem 'eventmachine', :github => 'krzcho/eventmachine', :branch => 'master'

在安装包之前指定 ssl 的位置(它必须是带有开发者头文件/库的完整版本的 ssl)

bundle config build.eventmachine --with-ssl-dir=c:/OpenSSL

我还需要让我自己变薄,这不会激活另一个 eventmachine,所以需要在 gemfile 中添加另一行:

gem 'thin', :github => 'krzcho/thin', :branch => 'master'

不幸的是,我在使用非自签名证书时仍然遇到问题: thin rails server/eventmachine on windows does not work with custom certificate (案例已结案 - 证书错误)

关于ruby-on-rails - Rails、Windows 和 HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28430623/

相关文章:

ruby-on-rails - 根据模型更改 Rails 部分的查找路径

ruby-on-rails - 使用已经不唯一的数据添加唯一的两列索引

c++ - WASAPI 何时添加了对 AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM 的支持?

python - 读取任何 PC 兼容的赛车方向盘输入

c++ - 为 Windows VS2013 构建 Boost 正则表达式

http持久连接和ssl session

ruby-on-rails - Ruby on Rails 4-回形针AWS Image URL错误吗?

ruby-on-rails - Ruby on Rails 未初始化常量

ruby-on-rails - 让 rails url helpers 使用适当的协议(protocol)?

java - 解决 javax.net.ssl.SSLHandshakeException : sun. security.validator.ValidatorException : PKIX path building failed Error?