我在Apache 2.2.15上。 我的vhost.conf包含一个RewriteRule来处理文章的URL;
# handling for neat article titles RewriteRule ^/news/[0-9]{4}/[A-za-z]{3}/([0-9a-zA-Z-]*)/([0-9]{4})([0-9]{6})/?$ "/news/article.cfm?clk=$2&article_id=$3&urltitle=$1" [P,L]
这是在我们的活服务器上正常工作,但是在我的本地开发服务器上,当我尝试加载文章时,浏览器中出现502错误:
Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /news/2015/news-article/0123012345. Reason: DNS lookup failure for: localhost.example.com Apache/2.2.15 (CentOS) Server at localhost.example.com Port 80
这是我在错误日志中得到的;
[Wed Oct 28 10:00:25 2015] [error] [client 192.168.1.66] proxy: DNS lookup failure for: localhost.example.com returned by /news/2015/news-article/0123012345, referer: http://localhost.example.com/
这使我相信在本地服务器的configuration中必然会有一些不同的东西导致它的问题。
这些是我启用的Apache模块;
$ apachectl -M | grep proxy proxy_module (shared) proxy_balancer_module (shared) proxy_ftp_module (shared) proxy_http_module (shared) proxy_ajp_module (shared) proxy_connect_module (shared) Syntax OK $ apachectl -M | grep rewrite rewrite_module (shared) Syntax OK
对不起,如果我遗漏了任何有关的信息,感谢任何意见。
消息
原因:DNS查找失败:localhost.example.com
表示服务器无法parsing代理模块将请求redirect到的主机名。
确保在/etc/hosts文件中有正确的条目。