使用 mod_proxy 时出现 502 DNS 相关错误

使用 mod_proxy 时出现 502 DNS 相关错误

我有一个在 Ruby 上运行的 Web 应用程序,我需要让它在 apache 下加载。该应用程序在端口 5000 上运行,因此我尝试使用 mod_proxy 让它运行,但收效甚微。

我的网站是 www.domain.com,我正在尝试使用 URL www.domain.com/status 加载 Web 应用程序

这是我最初对 vhost 文件进行的尝试:

<VirtualHost 10.0.31.110:80>
ServerName domain.com
ServerAlias www.domain.com
ServerAdmin [email protected]
DocumentRoot /var/www/website
ProxyPass /status http://127.0.0.1:5000
ProxyPassReverse / http://127.0.0.1:5000
</VirtualHost>

但是这不起作用,它只是加载了我主 www.domain.com 网站的一个未知页面。因此,为了进行故障排除,我尝试创建两个单独的虚拟主机,如下所示:

<VirtualHost 10.0.31.110:80>
ServerName domain.com
ServerAlias www.domain.com
ServerAdmin [email protected]
DocumentRoot /var/www/website
</VirtualHost>
<VirtualHost 10.0.31.110:80>
ServerName status.domain.com
ProxyPass / http://127.0.0.1:5000
ProxyPassReverse / http://127.0.0.1:5000
</VirtualHost>

然后访问 status.domain.com 我收到此错误:

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /setup/step1.

Reason: DNS lookup failure for: 127.0.0.1:5000setup

这是我的 Apache 错误日志中的内容:

[Fri Dec 30 19:45:14.826803 2016] [proxy:error] [pid 20280] [client 64.92.54.xxx:24492] AH00898: DNS lookup failure for: 127.0.0.1:5000favicon.ico returned by /favicon.ico, referer: http://status.domain.com/setup/step1

Ruby 站点会自动转发到 /setup/step1 URL,不过我认为这与它无关。

我一定是做错了什么...我以前从未使用过 mod_proxy,这对我来说是第一次,所以我确信我可能在这里遗漏了一些简单的东西,但却无法弄清楚。

相关内容