简体   繁体   English

SSL 证书 getaddrinfo:名称或服务未知(SocketError)Rails-4.2.0

[英]SSL Certificate getaddrinfo: Name or service not known (SocketError) Rails-4.2.0

I have Rails 4.2.0 application with ruby version 2.2.0.我有带有 ruby 版本 2.2.0 的 Rails 4.2.0 应用程序。 I have a requirement where I need to create an SSL certificate for the test environment.我有一个要求,我需要为测试环境创建 SSL 证书。

To set-up an SSL certificate I followed the below steps:要设置 SSL 证书,我按照以下步骤操作:

step-1: brew install mkcert第 1 步: brew install mkcert

step-2: Added entry on /etc/hosts for the localhost domain ie 127.0.0.1 localhost.application_name第 2 步:/etc/hosts上为 localhost 域添加条目,即127.0.0.1 localhost.application_name

step-3: Created the key and certificate files for domain which I created by mkcert localhost.application_name第 3 步:为我通过mkcert localhost.application_name创建的域创建密钥和证书文件

step-4: Then move those certificate files into the config\ssl folder第 4 步:然后将这些证书文件移动到config\ssl文件夹中

step-5: And then I start my rails server like bundle exec rails server -p 3000 -b 'ssl://127.0.0.1:3000?key=config/ssl/localhost.application_name-key.pem&cert=config/ssl/localhost.application_name.pem'第 5 步:然后我启动我的 rails 服务器,例如bundle exec rails server -p 3000 -b 'ssl://127.0.0.1:3000?key=config/ssl/localhost.application_name-key.pem&cert=config/ssl/localhost.application_name.pem'

When I run the rails s with the below command I am facing an error 'getaddrinfo': getaddrinfo: Name or service not known (SocketError)当我使用以下命令运行 rails 时,我遇到了错误'getaddrinfo': getaddrinfo: Name or service not known (SocketError)

For more clarity, I am attaching the screenshot after rails s execute.为了更清楚起见,我在 rails 执行后附上了屏幕截图。

在此处输入图像描述

I already tried a lot of solution which is being already present in StackOverflow but no luck as of now.我已经尝试了很多已经存在于 StackOverflow 中的解决方案,但到目前为止还没有运气。 Any help will be appreciated!任何帮助将不胜感激!

Note: I have rails application setup with Docker注意:我有使用 Docker 的轨道应用程序设置

Binding syntax you provided (with ssl:// scheme) is used with puma application server.您提供的绑定语法(使用ssl://方案)用于puma应用程序服务器。

WEBrick , which was the default application server with Rails 4.x, doesn't support this binding scheme. WEBrick是 Rails 4.x 的默认应用服务器,不支持这种绑定方案。

So you can jump to puma by simply adding to Gemfile所以你可以通过简单地添加到Gemfile来跳转到puma

gem 'puma'

and then run然后运行

bundle install

Then you'll be able to start your app as you're used to.然后你就可以像以前一样启动你的应用程序了。

暂无
暂无

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

相关问题 Rails Heroku SocketError:getaddrinfo:名称或服务未知 - Rails Heroku SocketError: getaddrinfo: Name or service not known 无法启动Rails服务器! “ getaddrinfo:名称或服务未知(SocketError)” - Can't start Rails server! “getaddrinfo: Name or service not known (SocketError)” Rails服务器错误“初始化”:getaddrinfo:名称或服务未知(SocketError) - rails server error `initialize': getaddrinfo: Name or service not known (SocketError) Rails 3机械化-SocketError:getaddrinfo:主机或名称未知 - Rails 3 Mechanize - SocketError: getaddrinfo: Host or name not known Elasticsearch SocketError(getaddrinfo:名称或服务未知) - Elasticsearch SocketError (getaddrinfo: Name or service not known) 「rescue500 => SocketError : getaddrinfo: Name or service not known」无法解析 - 「rescue500 => SocketError : getaddrinfo: Name or service not known」 cannot be resolved 在狂欢中面临问题 SocketError (getaddrinfo: Name or service not known) - Facing issue SocketError (getaddrinfo: Name or service not known) in spree aws-sdk gem:SocketError:getaddrinfo:名称或服务未知 - aws-sdk gem: SocketError: getaddrinfo: Name or service not known UsuariosController#forgot中的SocketError-getaddrinfo:名称或服务未知 - SocketError in UsuariosController#forgot - getaddrinfo: Name or service not known Rails 3-动作邮件SocketError getaddrinfo没有此类主机 - Rails 3 - action mailer SocketError getaddrinfo No such host is known
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM