简体   繁体   English

创建Rails的SSL证书

[英]Create ssl certificate for rails

I am using ruby 2.0.0, rails 3.2.6 and running my project in EC2 server. 我正在使用ruby 2.0.0,rails 3.2.6并在EC2服务器中运行我的项目。

Now I want to generate ssl certificate to my project. 现在,我想为我的项目生成ssl证书。

Where I can find the certificate and how should I include into my project.Can anyone guide me? 在哪里可以找到证书,以及如何将其包含在项目中。有人可以指导我吗?

Now I want to generate ssl certificate to my project. 现在,我想为我的项目生成ssl证书。

I am presuming that you are talking about creating self-signed certificate. 我假设您正在谈论创建自签名证书。 Follow these steps to generate a self -signed certificate: 请按照以下步骤生成自签名证书:

Generate a Private key and CSR: openssl req -newkey rsa:2048 -nodes -keyout key.pem -out req.pem 生成私钥和CSR: openssl req -newkey rsa:2048 -nodes -keyout key.pem -out req.pem

Above command will create your private key key.pem and a CSR req.pem 上面的命令将创建您的私钥key.pem和CSR req.pem

Generate a self-signed Cert: openssl x509 -req -days 365 -in req.pem -signkey key.pem -out cert.pem 生成自签名证书: openssl x509 -req -days 365 -in req.pem -signkey key.pem -out cert.pem

Above command will use key.pem and req.pem and will create certificate cert.pem . 上面的命令将使用key.pemreq.pem并将创建证书cert.pem

You have to follow the prompts given by above commands and provide answers accordingly. 您必须遵循上述命令给出的提示并提供相应的答案。

If you do not want a self-signed certificate, then you need to buy SSL certificate from a vendor. 如果您不想使用自签名证书,则需要从供应商处购买SSL证书。 There are numerous companies which provide SSL certificate. 有许多公司提供SSL证书。 You need to create a private key and a CSR (certificate signing request). 您需要创建一个私钥和一个CSR(证书签名请求)。 you can follow 1st command above to achieve this. 您可以按照上面的第一个命令来实现。 Once done, then you have to provide the CSR to the SSL vendor who will get you the certificate. 完成后,您必须将CSR提供给SSL供应商,后者将为您提供证书。

There are a lot of details around this process. 关于此过程有很多细节。 Please check http://www.sslshopper.com/ for more information around SSL. 访问http://www.sslshopper.com/了解有关SSL的更多信息。

how should I include into my project 我应该如何纳入我的项目

please check below links: 请检查以下链接:

http://www.buildingwebapps.com/articles/79189-using-ssl-in-rails-applications http://www.buildingwebapps.com/articles/79189-using-ssl-in-rails-applications

How to include SSL Certificate in Rails 3 project 如何在Rails 3项目中包含SSL证书

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM