简体   繁体   English

如何设置本地SSL证书和Rails应用程序?

[英]How can I setup a local SSL certificate and a Rails application?

This might be a two-in-one question. 这可能是一个二合一的问题。

  1. 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使用它?

  2. 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 
  1. Yes you can. 是的你可以。 Here is a gist explaining the process: 这是一个解释过程的要点:

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

  1. 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.

相关问题 我如何避免在Heroku托管的站点(使用Rails构建)上发生SSL错误而无需支付SSL证书 - How can I avoid an SSL error on a Heroku-hosted site (built with Rails) without paying for an SSL certificate 使用Rails应用程序进行SSL证书安装的Nginx配置 - nginx configuration for ssl certificate installation with rails application 如何使用内部签名的SSL证书部署Rails应用程序(SSL_CERT_FILE和openssl相关) - How to deploy a Rails application with an internally signed SSL certificate (SSL_CERT_FILE and openssl related) 如何在rails 4应用程序上设置ssl? (nginx +乘客) - How do I setup ssl on a rails 4 app? (nginx + passenger) Rails.application.initialize之后,Rails SSL证书验证失败 - Rails ssl certificate verify failed after Rails.application.initialize 升级到 Chrome 73 后,SSL 证书无法在 Rails 本地工作 - SSL certificate not working on rails local after upgrading to Chrome 73 如何在Rails 3项目中包含SSL证书 - How to include SSL Certificate in Rails 3 project 如何使用Rails 4设置水豚 - How can I setup capybara with rails 4 创建Rails的SSL证书 - Create ssl certificate for rails 如何在 Nginx 和 Unicorn 上为 Rails 应用程序配置 SSL? - How do I configure SSL on Nginx and Unicorn for Rails application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM