[英]How can I setup a local SSL certificate and a Rails application?
This might be a two-in-one question. 这可能是一个二合一的问题。
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应用程序,托管在Raspberry Pi上,我想知道是否可以为它创建本地SSL证书并设置Rails使用它?
If yes, how can I setup my Rails/Puma/Foreman/Ubuntu application? 如果是,我如何设置我的Rails / Puma / Foreman / Ubuntu应用程序? For now, I am running the application with Foreman, by using a Procfile:
现在,我使用Procfile运行Foreman的应用程序:
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 https://gist.github.com/tadast/9932075
My procfile contains an entry that looks like this: 我的procfile包含一个如下所示的条目:
server: rails server puma -b 'ssl://0.0.0.0:3000?key=server.key&cert=server.crt' server:rails server puma -b'sssl://0.0.0.0:3000?key = server.key&cert = server.crt'
This seems to work for me. 这似乎对我有用。 I also set
我也定了
config.force_ssl = true
in config/application.rb 在config / application.rb中
I gathered info about it from all these places: 我从所有这些地方收集了有关它的信息:
https://github.com/puma/puma https://github.com/puma/puma
http://www.railway.at/2013/02/12/using-ssl-in-your-local-rails-environment/ 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.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 http://www.eq8.eu/blogs/14-config-force_ssl-is-different-than-controller-force_ssl
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.