我已经在生产中使用 private_pub 一年多了,最近我刚刚将应用程序从 http 移动到 https。我们已经安装了签名证书,应用程序中的其他一切都在工作,但是当我 private_pub/thin 提交任何要推送的内容时,我收到以下错误。
SocketError (getaddrinfo: Name or service not known)
我无法找到任何关于此错误和 private_pub/thin 的具体问题,但我看到的其他问题与 sunspot/solr 在需要 127.0 时指向 localhost 有关.0.1。我的 private_pub 配置使用实际的 https://domain.com .
我的应用程序能够连接到 faye.js,但我收到上面的服务器错误。
private_pub_thin.yml:
---
port: 4443
ssl: true
ssl_key_file: /path/to/ssl.key
ssl_cert_file: /path/to/ssl.cert
environment: production
rackup: private_pub.ru
daemonize: true
private_pub.yml:
production:
server: "https://sub.mydomain.com:4443/faye"
secret_token: "<token here>"
signature_expiration: 3600 # one hour
private_pub.ru:
require "bundler/setup"
require "yaml"
require "faye"
require "private_pub"
Faye::WebSocket.load_adapter('thin')
PrivatePub.load_config(File.expand_path("../config/private_pub.yml", __FILE__), ENV["RAILS_ENV"] || "development")
run PrivatePub.faye_app
如有任何想法,我们将不胜感激。提前谢谢你
--- 编辑---
我没有提到这一点,但我确实在服务器的 iptables 上打开了端口 4443,我什至尝试完全关闭 iptables 进行测试。仍然有同样的错误
最佳答案
想通了......这一切都与 SSL 证书有关。
看来我缺少 CA Bundle,或者只是没有正确安装。修复此问题,然后在此处执行此修复:Using private_pub with SSL
将 ca_bundle 附加到实际有效的证书中。
还有一些我发现的有助于调试的有用工具:
https://github.com/mislav/ssl-tools/tree/8b3dec4bedcc725a142fa9bc297610f8d09f5d9d https://www.digicert.com/help/
希望对其他人有帮助。
关于ruby-on-rails - private_pub gem rails 和 https 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27865662/