我将其放入我的 /etc/hosts 文件中:
198.252.206.16 stackoverflowtest.com
当我stackoverflowtest.com
在浏览器中尝试时,出现了这个 Squid 错误:
ERROR
The requested URL could not be retrieved
The following error was encountered while trying to retrieve the URL: http://stackoverflowtest.com/
Unable to determine IP address from host name stackoverflowtest.com
The DNS server returned:
Name Error: The domain name does not exist.
This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct.
Your cache administrator is webmaster.
而不是这样:
Stack exchange
Couldn't find 198.252.206.16
...
为什么 squid 会破坏主机文件?有什么解决方法吗?
答案1
您需要更新 squid 服务器上的 hosts 文件。原因是您的浏览器将目标 URL 发送到代理,而不是在本地解析主机名。
答案2
您可以/etc/hosts
在代理虚拟机/服务器内部添加映射,不在客户端笔记本电脑/电脑中