简体   繁体   English

卷曲错误“没有替代证书。”

[英]Curl error “no alternative certificate..”

We have a problem in only one of our servers hosted at Amazon (the development server). 我们只有一个托管在亚马逊上的服务器(开发服务器)存在问题。 The problem happens when doing a curl request to a specific domain, by running this: 通过运行以下命令向特定域执行curl请求时,会发生问题:

> curl https://api.plivo.com

Results in: 结果是:

curl: (51) SSL: no alternative certificate subject name matches target host name 'api.plivo.com' curl:(51)SSL:没有其他证书主题名称与目标主机名“ api.plivo.com”匹配

I did some research and found out that it might be a problem with the server's certificate, however if I try this from any other server it works fine, same on my local machine. 我进行了一些研究,发现服务器的证书可能有问题,但是,如果我从其他任何服务器上尝试使用此证书,都可以正常工作,与本地计算机上的证书相同。 So I'm thinking that this might be a cache issue from curl? 因此,我认为这可能是curl造成的缓存问题? I tried reinstalling it, updating it, but no dice. 我尝试重新安装,更新它,但没有骰子。 I'm almost creating a new dev machine because of this, because it's blocking us from using this service. 因此,我几乎要创建一台新的开发机,因为它阻止了我们使用该服务。

To summarize from the comments: 从评论中总结:

  • The good and the bad system actually accessed different servers which were configured with different certificates. 好的和坏的系统实际上访问了配置有不同证书的不同服务器。 That's why it failed on one system but not on the other. 这就是为什么它在一个系统上失败而在另一个系统上失败的原因。
  • The reason for this difference was that the bad system had an entry in /etc/hosts which was used instead of asking the DNS server. 造成这种差异的原因是,错误的系统在/etc/hosts有一个条目,该条目是用来代替DNS服务器的。
  • The problem was found by comparing the output of curl -v and realizing that the shown target IP address was different. 通过比较curl -v的输出并意识到所显示的目标IP地址不同,发现了问题。
  • The problem was fixed by removing the old entry in /etc/hosts so that it now queries the DNS server and gets the correct IP address of the server. 通过删除/etc/hosts的旧条目已解决了该问题,以便现在可以查询DNS服务器并获取服务器的正确IP地址。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM