【问题标题】:Apache Webserver ReverseProxy to serve Apache Solr Admin PanelApache Webserver ReverseProxy 为 Apache Solr 管理面板提供服务
【发布时间】:2017-02-16 13:10:19
【问题描述】:

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

DNS:my.server.com

IP:xxx.xxx.xxx

服务器操作系统: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之后启用了一些模块:

  • a2enmod 代理
  • a2enmod proxy_http
  • a2enmod proxy_ajp
  • a2enmod 重写
  • a2enmod 放气
  • a2enmod 标头
  • a2enmod proxy_balancer
  • a2enmod proxy_connect
  • a2enmod proxy_html

然后我尝试在/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 错误。

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

提前致谢!

【问题讨论】:

  • 尝试使用后端 ip 而不是名称,以防您的名称解析没有按照您的想法进行。

标签: apache solr debian jetty reverse-proxy


【解决方案1】:

原来我需要在 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/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-04-02
    • 2012-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-23
    • 2013-02-26
    • 2012-01-18
    相关资源
    最近更新 更多