sh Rails SSL Localhost

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Rails SSL Localhost相关的知识,希望对你有一定的参考价值。

# SSL self signed localhost for rails start to finish, no red warnings. 

# 1) In your rails applicaiton root folder create self signed certificate

$ openssl req -new -newkey rsa:2048 -sha1 -days 365 -nodes -x509 -subj "/C=US/ST=Colorado/L=Colorado Springs/O=SW/CN=localhost.ssl" -keyout server.key -out server.crt

# 2) Add localhost.ssl to your hosts file

$ echo "127.0.0.1 localhost.ssl" | sudo tee -a /etc/hosts

# 3) Boot thin http://code.macournoyer.com/thin/

$ thin start --ssl --ssl-key-file server.key --ssl-cert-file server.crt

# 4) Add server.crt as trusted !!SYSTEM!! (not login) cert in the mac osx keychain
# Open keychain tool, drag .crt file to system, and trust everything.

# Notes:
# 1) Https traffic and http traffic can't be served from the same thin process. If you want 
#    both you need to start two instances on different ports.

以上是关于sh Rails SSL Localhost的主要内容,如果未能解决你的问题,请参考以下文章

sh Rails 3.2.7 SSL Localhost(没有红色警告,没有apache配置)

sh [generate pem file] self-certiticate ssl for localhost或VPS

force_ssl 在 Rails 中做了啥?

在 Rails 应用程序中向 PostgreSQL 提供 SSL 证书

Rails 3:OpenSSL::SSL::SSLError:主机名与服务器证书不匹配

Rails Heroku Cloudflare SSL 和 websockets