[英]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.