简体   繁体   English

在 RoR 中为 open-uri 设置新的 DNS

[英]Setting a new DNS for open-uri in RoR

I'm having a problem to access a web site from RoR using open-uri.我在使用 open-uri 从 RoR 访问网站时遇到问题。

In my local machine I have no problem but on the server the servers DNS doesn't resolve the uri.在我的本地机器上,我没有问题,但在服务器上,服务器 DNS 无法解析 uri。

Is there a way to set google DNSs before an open-uri call?有没有办法在 open-uri 调用之前设置谷歌 DNS?

Thanks.谢谢。

require 'open-uri'
open("fuel-prices-europe.info")

Can you put the resolve in /etc/hosts?你能把解决方案放在 /etc/hosts 中吗? or just use the ip?还是只使用ip?

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

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