升级到 Ruby 2.0 之后，我在 Rails 开发中遇到了这个问题，不过，很快就在网上看到了问题的原因和解决方法，以下适用于 Mac OS X，相信 linux 下原理一致
Are you getting an error “OpenSSL certificate verify failed” with Ruby?
Or an error “Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0”?
You may be seeing Ruby problems with OpenSSL because of conflicts with older versions of OpenSSL or outdated certificate files.
Here are suggestions.
If you get OpenSSL errors with Ruby 2.0, make sure you are using RubyGems 2.0.3 or newer:
$ gem -v
gem update --system to upgrade the RubyGems system gem if necessary
The version of OpenSSL that comes with Mac OS X 10.8 is too old for Ruby 2.0. You need to install a newer one with RVM or Homebrew.
You should have OpenSSL 1.0.1e or newer installed in your environment:
$ openssl version
If you are using RVM, the newest version of RVM will install OpenSSL automatically. See the article Installing Rails. This may be the easiest solution.
You can also install Homebrew and try this:
$ brew update $ brew install openssl $ brew link openssl --force $ brew install curl-ca-bundle
If OpenSSL is up to date, you may be having problems with outdated certificate files.
James Tucker (raggi) has released a simple script (openssl-osx-ca) that uses Homebrew to update the OpenSSL security certificates found in the Mac OS X Keychain. The script replaces the outdated OpenSSL security certificates on your Mac with new certificates from Mozilla.org
$ brew tap raggi/ale $ brew install openssl-osx-ca