linux不能解析DNS问题

 今天遇到在服务器上添加网站,要调用微博接口,但是怎么不能实现。

初步的解决方法是dig出来接口IP,然后添加hosts解析可以实现接口通信。

后来觉得不是根本解决方法,寻求方法解决。

查看/etc/resolv.conf 内容有很多行nameserver ,不能解析的都添加#注释。

后来做一个php测试文件怎么都解析不了。

测试文件内容

more test.php

<?php

echo file_get_contents("http://www.baidu.com");

phpinfo ();

?>

放到根目录访问是打不开这个test.php文件的。


下面是解决方法。

查看本机hostname=localhost.aaa

在/etc/resolv.conf文件中写入如下内容:

#aaa          #此处为注释hostname值

nameserver 114.114.114.114

nameserver 8.8.8.8


把多余的nameserver都删掉。

重启网卡/etc/init.d/network restar

测试访问 test.php

解析了。


本机还有VSFTP服务,他们反映浏览或者传文件很慢,网络搜索方法

另外一个办法是在vsftpd.conf文件中加入:reverse_lookup_enable=NO

保存后重新启动vsftpd 就OK,service vsftpd restart 

 

你可能感兴趣的:(linux,解析,ftp,nameserver)