Linux出现“Could not resolve: api.weixin.qq.com (Could not contact DNS servers)”解决办法

在请求微信小程序服务时候报错了,如下图:

请求微信api报错

从这个报错,可以很明显的发现是域名解析不了;

 

1、故障排查

因为代码里调用的是curl,所以测试一下curl是否能够正常解析dns;

curl api.weixing.qq.com

curl api.weixing.qq.com

果然不行!

 

2、解决办法

vi /etc/resolv.conf

添加或者修改 DNS

nameserver 114.114.114.114
nameserver 8.8.8.8

重新测试curl,问题得到解决。

    A+
发布日期:2018年02月17日 16:19:57  所属分类:Linux
最后更新时间:2018-02-17 16:20:19
头像
  • ¥ 159.0元
  • 市场价:398.0元
  • ¥ 199.0元
  • 市场价:179.0元
  • ¥ 89.0元
  • 市场价:129.0元
  • ¥ 199.0元
  • 市场价:199.0元

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: