Ruby-on-rails 在瘦服务器上的 rails 应用程序中启用 https
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11589636/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Enable https in a rails app on a thin server
提问by banditKing
I have a rails app running a thin server on heroku. It currently uses http. I would like to use https for bot development and production. Where do I begin to do this.
我有一个在 heroku 上运行瘦服务器的 rails 应用程序。它目前使用http。我想使用 https 进行机器人开发和生产。我从哪里开始这样做。
I have looked at this railscastwhere they show how to use a POW server. I dont want to use a POW server, I want to use a Thin server.
我看过这个railscast,他们展示了如何使用 POW 服务器。我不想使用 POW 服务器,我想使用瘦服务器。
I also looked here: But here they assume that you have open ssl insatlled.
我也看过这里:但在这里他们假设你已经打开了 ssl 安装。
I haven't found any place which shows how to run https on a thin server from scratch.
我还没有找到任何展示如何从头开始在瘦服务器上运行 https 的地方。
I was wondering if anyone has any suggestions.
我想知道是否有人有任何建议。
Thanks
谢谢
回答by Tanzeeb Khalili
Try this:
尝试这个:
$ thin start --ssl
You will need a separate instance if you want both ssl and non-ssl ports.
如果您同时需要 ssl 和非 ssl 端口,您将需要一个单独的实例。
回答by skrypalyk
I don't know if you need it, but this helped me:
我不知道你是否需要它,但这对我有帮助:
thin start --ssl --ssl-verify --ssl-key-file ssllocal/server.key
--ssl-cert-file ssllocal/server.crt
edit path to ssl key and ssl fild. For example my keys were in paypal folder, so command was
编辑 ssl 密钥和 ssl fild 的路径。例如我的钥匙在贝宝文件夹中,所以命令是
thin start --ssl --ssl-verify --ssl-key-file paypal/server.key
--ssl-cert-file paypal/server.crt
If you will have problems you can look at this post - Thin with SSL support and ruby-debug.
如果您遇到问题,可以查看这篇文章 - Thin with SSL support and ruby-debug。
Hope this helps.
希望这可以帮助。
回答by Hieu Le
You should to use thinto do it:
你应该使用瘦来做到这一点:
$ sudo apt-get install thin
And add this line in config/application.rb
并在 config/application.rb 中添加这一行
config.force_ssl = true
Then run app on thin with command line:
然后使用命令行在瘦上运行应用程序:
$ thin start --ssl

