【问题标题】:How can I setup a local SSL certificate and a Rails application?如何设置本地 SSL 证书和 Rails 应用程序?
【发布时间】:2016-05-01 17:15:35
【问题描述】:

这可能是一个二合一问题。

  1. 我有一个用于家庭/爱好的 Rails 应用程序,托管在 Raspberry Pi 上,我想知道是否可以为其创建本地 SSL 证书并设置 Rails 以使用它?

  2. 如果是,我该如何设置我的 Rails/Puma/Foreman/Ubuntu 应用程序?现在,我正在使用 Foreman 运行应用程序,使用 Procfile:

    web: bundle exec puma -t 8:8 -p 3000
    worker: bundle exec sidekiq
    clock: bundle exec clockwork config/clock.rb
    

【问题讨论】:

  • puma 自述文件建议您可以使用 -b 选项执行此操作

标签: ruby-on-rails ruby ssl puma foreman


【解决方案1】:
  1. 是的,你可以。以下是解释该过程的要点:

https://gist.github.com/tadast/9932075

  1. 我的 procfile 包含一个如下所示的条目:

    服务器:rails server puma -b 'ssl://0.0.0.0:3000?key=server.key&cert=server.crt'

这似乎对我有用。我也设置了

config.force_ssl = true 

在 config/application.rb 中

我从所有这些地方收集了有关它的信息:

https://github.com/puma/puma

http://www.railway.at/2013/02/12/using-ssl-in-your-local-rails-environment/

http://www.panozzaj.com/blog/2013/08/12/how-to-set-up-local-https-development/

http://www.eq8.eu/blogs/14-config-force_ssl-is-different-than-controller-force_ssl

【讨论】:

  • 嘿,我完成了以下所有步骤,我得到的只是No such key file 'server.key',我看到在.ssh 文件夹中生成了我的server.key 文件。有什么想法吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-08-27
  • 1970-01-01
  • 2015-04-28
  • 2023-04-07
相关资源
最近更新 更多