[英]SSL_connect returned=1 errno=0 state=error: certificate verify failed also I tried to install gem openssl but can't
require 'rubygems'
require 'httparty'
class myClass
include HTTParty
base_uri 'https://jsonplaceholder.typicode.com'
def posts
self.class.get('/users')
end
end
So, I got this error.所以,我得到了这个错误。 And the simplest solution to this is as below.
最简单的解决方案如下。
Download cacert.pem file from this link http://curl.haxx.se/ca/cacert.pem从此链接下载 cacert.pem 文件http://curl.haxx.se/ca/cacert.pem
So, I have installed my Ruby in D drive inside Railsinstaller folder likewise, "D:\RailsInstaller\Ruby2.3.3\lib\ruby\2.3.0\rubygems\ssl_certs" go to the directory where you have install ruby and got to this path "Ruby2.3.3\lib\ruby\2.3.0\rubygems\ssl_certs inside this save the cacert.pem file, make sure it is.pem file. So, I have installed my Ruby in D drive inside Railsinstaller folder likewise, "D:\RailsInstaller\Ruby2.3.3\lib\ruby\2.3.0\rubygems\ssl_certs" go to the directory where you have install ruby and got to this path "Ruby2.3.3\lib\ruby\2.3.0\rubygems\ssl_certs在这个里面保存cacert.pem文件,确保是.pem文件。
Now, go to the environment.rb file in your rails application and save as below: ENV['SSL_CERT_FILE'] = "/your/file/path/cacert.pem"现在,go 到您的 rails 应用程序中的 environment.rb 文件并保存如下: ENV['SSL_CERT_FILE'] = "/your/file/path/cacert.pem"
and DONE!并做了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.