通过端口 443 运行 Apache 代理

通过端口 443 运行 Apache 代理

我希望能够将进入我的中央服务器的 http 和 https 流量重定向到不同的虚拟服务器。

我有一台主机(中央服务器)和四台不同的客户机。每台客户机都托管一个不同域名的网站。每个域名从外部解析到我的主机服务器。在我的主机上,我配置了 Apache 以使用 VirtualHosts 和 ProxyPass(& ProxyPassReverse)将端口 80 的请求重定向到正确的对应客户机。这工作正常。Joy

但其中两个域也配置了 SSL,并且也在监听端口 443。这就是问题所在。我收到 SSL 证书错误,我不知道如何修复它们。

NameVirtualHost 192.168.1.1:80 ServerName www.domain1.nl ProxyPreserveHost On ProxyPass /http://www.domain1.nl/ ProxyPassReverse /http://www.domain1.nl/ ErrorLog 日志/domain1-error_log CustomLog 日志/domain1-access_log 合并

<VirtualHost 192.168.1.1:80>
        ServerName www.domain2.net
    ProxyPreserveHost On
    ProxyPass / http://www.domain2.net/
    ProxyPassReverse / http://www.domain2.net/
    ErrorLog logs/domain2-error_log
    CustomLog logs/domain2-access_log combined
</VirtualHost>
<VirtualHost 192.168.1.1:80>
        ServerName www.domain3.org
    ProxyPreserveHost On
    ProxyPass / http://www.domain3.org/
    ProxyPassReverse / http://www.domain3.org/
    ErrorLog logs/domain3-error_log
    CustomLog logs/doman3-access_log combined
</VirtualHost>


NameVirtualHost 192.168.1.1:443
<VirtualHost 192.168.1.1:443>
        ServerName www.domain2.net
    ProxyPreserveHost On
    ProxyPass / https://www.domain2.net
    ProxyPassReverse / https://www.domain2.net
    ErrorLog logs/domain2-error_log
    CustomLog logs/domain2-access_log combined
</VirtualHost>
<VirtualHost 192.168.1.1:443>
        ServerName www.domain3.org
    ProxyPreserveHost On
    ProxyPass / https://www.domain3.org/
    ProxyPassReverse / https://www.domain3.org/
    ErrorLog logs/domain3-error_log
    CustomLog logs/domain3-access_log combined
</VirtualHost>

正如我所说,正常的 80 端口请求会按照我想要的方式路由到正确的服务器。但 443 端口上的请求会导致:

ssl_error_rx_record_too_long

现在我尝试了在互联网上找到的一些方法,例如添加:SSLProxyEngine On SSLProxyCheckPeerCN on 但这要么没有效果,要么使事情变得更糟。

有什么想法吗?

答案1

cmiiw 443 是 https 协议,浏览器会假定它是 https。如果您确实在另一台 https 服务器上使用 ssl,则必须在 http 代理上安装证书。

https:443 (证书 ssl) ==> http:80

相关内容