Apache Web 服务器反向代理服务于 Apache Solr 管理面板

Apache Webserver ReverseProxy to serve Apache Solr Admin Panel

我正在尝试 运行 远程服务器上的 Apache Solr 服务(在其嵌入式码头服务器上)。管理员向我提供了以下信息:

DNS: my.server.com

IP: xxx.xxx.xxx

服务器OS: 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux

只能访问端口 80。在服务器上,我们要部署 Apache Solr 和一个使用 Solr 作为搜索引擎的微服务。我想使用 Apache Webserver 将 HTTP-Request 转发到 Solr Admin UI 和微服务 UI,但它似乎不起作用,我使用 Apache Server 版本:Apache/2.4.10 (Debian) 服务器构建:2016 年 9 月 15 日 20:44:43.

我安装了 Apache 并启动了服务器,目前一切正常。我可以从 Apache 访问管理视图,在我的浏览器中输入 DNS。

我在这篇文章后启用了几个模块 https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension:

然后我尝试在/etc/apache2/sites-available/myconf.conf:

下配置一个虚拟主机
 <VirtualHost *:80>
  DocumentRoot /var/www/html
  ErrorLog /var/log/apache2/error.log
  CustomLog /var/log/apache2/access.log combined

  ProxyPass        /solr http://my.server.com:8983 retry=0 timeout=5
  ProxyPassReverse /solr http://my.server.com:8983
  ProxyPass        /microservice http://my.server.com:6868 retry=0 timeout=5
  ProxyPassReverse /microservice http://my.server.com:6868
  LogLevel debug

</VirtualHost>

Solr 使用其标准端口 8983,微服务将在端口 6868 上。当我尝试使用 http://my.server.com/solr 访问 solr 时,出现 HTTP 503 服务不可用。

我第一次尝试这个:

/usr/sbin/setsebool -P httpd_can_network_connect 1

但这并没有改变什么。我也必须先安装:

apt-get install policycoreutils

使该选项可用。 solr 服务好像没问题:

solr status

Found 1 Solr nodes:

Solr process 14082 running on port 8983
{
  "solr_home":"/etc/apache-solr/solr-6.2.0/server/solr",
  "version":"6.2.0 764d0f19151dbff6f5fcd9fc4b2682cf934590c5 - mike - 2016-08-20 05:41:37",
  "startTime":"2016-10-07T12:02:05.300Z",
  "uptime":"0 days, 1 hours, 29 minutes, 55 seconds",
  "memory":"29.7 MB (%6.1) of 490.7 MB"}

Apache 日志一直在说:

The timeout specified has expired: AH00957: HTTP: attempt to connect to xxx.xxx.xxx:8983 (my.server.com) failed
AH00959: ap_proxy_connect_backend disabling worker for (my.server.com) for 0s
AH01114: HTTP: failed to make connection to backend: my.server.com

没有我的超时设置,一切都保持不变,但在我收到 503 错误之前需要很长时间。

有什么提示吗?经过一天的挣扎,我很沮丧……我只想完成任务。

提前致谢!

原来我需要在 url 上附加一个斜线:

  ProxyPass        /solr/ http://my.server.com:8983/ retry=0 timeout=5
  ProxyPassReverse /solr/ http://my.server.com:8983/
  ProxyPass        /microservice/ http://my.server.com:6868/ retry=0 timeout=5
  ProxyPassReverse /microservice/ http://my.server.com:6868/