问题描述
这可能是一个二合一问题.
This might be a two-in-one question.
我有一个用于家庭/业余爱好的 Rails 应用程序,托管在 Raspberry Pi 上,我想知道是否可以为其创建本地 SSL 证书并设置 Rails 以使用它?
I have a Rails application for home/hobby usage, hosted on a Raspberry Pi and I was wondering if it's possible to create a local SSL certificate for it and setup Rails to use it?
如果是,我该如何设置 Rails/Puma/Foreman/Ubuntu 应用程序?现在,我使用 Procfile 与 Foreman 一起运行应用程序:
If yes, how can I setup my Rails/Puma/Foreman/Ubuntu application? For now, I am running the application with Foreman, by using a Procfile:
web: bundle exec puma -t 8:8 -p 3000
worker: bundle exec sidekiq
clock: bundle exec clockwork config/clock.rb
推荐答案
- 是的,你可以.以下是解释该过程的要点:
https://gist.github.com/tadast/9932075
我的 procfile 包含一个如下所示的条目:
My procfile contains an entry that looks like this:
服务器:rails server puma -b 'ssl://0.0.0.0:3000?key=server.key&cert=server.crt'
server: rails server puma -b 'ssl://0.0.0.0:3000?key=server.key&cert=server.crt'
这似乎对我有用.我也设置了
This seems to work for me. I also set
config.force_ssl = true
在 config/application.rb 中
in config/application.rb
我从所有这些地方收集了有关它的信息:
I gathered info about it from all these places:
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
这篇关于如何设置本地 SSL 证书和 Rails 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!