首页 > 解决方案 > Apache2 和 solr 与 SSL 使用 proxypass

问题描述

我正在尝试在我的 Apache2 虚拟主机上设置一个子域,该子域将响应端口 443 上的 solr 请求。

我设置了我的 solr 8.1.1,我的 ip 在端口 8984 可以访问它,现在我需要它以https://solr.mydomain.org的形式使用,所以我尝试设置一个这样的虚拟主机:

<VirtualHost *:80>
ServerName solr.mydomain.org
Redirect permanent /secure https://solr.mydomain.org
</VirtualHost>
<VirtualHost *:443>
    ServerName solr.mydomain.org
    ErrorLog /var/log/apache2/error.solr.log
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>
    SSLEngine on
    SSLProxyEngine on
            SSLCertificateFile /etc/apache2/ssl/ca.crt
            SSLCertificateKeyFile /etc/apache2/ssl/ca.key
    ProxyPass / http://localhost:8984/
    ProxyPassReverse / http://localhost:8984/
 </VirtualHost>

在我找到这个答案(和注释)和其他在线指南之后。

我还安装了这里建议的所有模组。我已经删除了这些行

ProxyRequests           Off
ProxyPreserveHost       On

在根据建议对它们进行测试但没有成功之后,它们不再需要。

不幸的是,当我尝试从网络访问 solr.mydomain.org 时,我超时了。有人可以指出我正确的方向吗?

编辑:一旦我修复了主机文件中的错误,代码几乎可以正常工作(没有 http 到 https 重定向)!我不确定是否应该删除它或者它是否有任何帮助。

编辑2:重定向的固定代码,现在我真的很愚蠢!

<VirtualHost *:80>
ServerName solr.mydomain.org
Redirect permanent / https://solr.mydomain.org
</VirtualHost>
<VirtualHost *:443>
    ServerName solr.mydomain.org
    ErrorLog /var/log/apache2/error.solr.log
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>
    SSLEngine on
    SSLProxyEngine on
            SSLCertificateFile /etc/apache2/ssl/ca.crt
            SSLCertificateKeyFile /etc/apache2/ssl/ca.key
    ProxyPass / http://localhost:8984/
    ProxyPassReverse / http://localhost:8984/
 </VirtualHost>

标签: apachesslsolrproxypass

解决方案


推荐阅读