![代理导致“名称错误:域名不存在”Apache2](https://linux22.com/image/790973/%E4%BB%A3%E7%90%86%E5%AF%BC%E8%87%B4%E2%80%9C%E5%90%8D%E7%A7%B0%E9%94%99%E8%AF%AF%EF%BC%9A%E5%9F%9F%E5%90%8D%E4%B8%8D%E5%AD%98%E5%9C%A8%E2%80%9DApache2.png)
当我通过在 /etc/environment 中输入地址来激活代理时,我托管在我的网络服务器上的网站变得无法访问,并出现以下错误消息(片段):
<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href="http://www.correct.url.com/">http://www.correct.url.com/</a></p>
<blockquote id="error">
<p><b>Unable to determine IP address from host name <q>http://www.correct.url.com</q></b></p>
</blockquote>
<p>The DNS server returned:</p>
<blockquote id="data">
<pre>Name Error: The domain name does not exist.</pre>
</blockquote>
<p>This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct.</p>
当代理不存在时,网站可以正确加载。当代理处于活动状态时,我可以访问 google 和 youtube 等网站。当代理处于活动状态时,给定域名的 Nslookup 也可以工作,因此 DNS 服务器似乎没有问题。Apache 的运行用户也可以成功对域进行 nslookup。我已停用防火墙。
该网站的配置文件目前如下所示:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerName www.correct.url.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# I tried these earlier but it doesn't work
#ProxyPass / http://proxy.com:8080/
#ProxyPassReverse / http://proxy.com:8080/
#ProxyPass / http://www.correct.url.com/
#ProxyPassReverse / http://www.correct.url.com/
#<Proxy *>
# Order deny,allow
# Allow from all
#</Proxy>