如何配置 apache 服务器与 HTTPS 后端服务器通信?

我将 apache 服务器配置为反向代理,如果将后端服务器指向 HTTP,那么它就可以正常工作。那就是:

我将虚拟主机443配置为:

ProxyPass /primary/store http://localhost:9763/store/
ProxyPassReverse /primary/store http://localhost:9763/store/

在这里,用户将像 https://localhost/primary/store那样访问服务器

这个工作很好... 但我想配置 HTTP 服务器喜欢;

ProxyPass /primary/store https://localhost:9443/store/
ProxyPassReverse /primary/store https://localhost:9443/store/

当我像 apache 服务器一样配置时,会出现500个内部服务器错误。我在这里做错了什么?

我得到的错误是:

The server encountered an internal error or misconfiguration and was unable to complete your request.


Please contact the server administrator, you@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.


More information about this error may be available in the server error log.

在 apache 错误日志中,它声明;

nt: SSLProxyEngine]
[Mon Aug 04 00:03:26 2014] [error] proxy: HTTPS: failed to enable ssl support for [::1]:9443 (localhost)
[Mon Aug 04 00:03:31 2014] [error] [client ::1] SSL Proxy requested for localhost:443 but not enabled [Hint: SSLProxyEngine]
[Mon Aug 04 00:03:31 2014] [error] proxy: HTTPS: failed to enable ssl support for [::1]:9443 (localhost)
[Mon Aug 04 00:03:51 2014] [error] [client ::1] SSL Proxy requested for localhost:443 but not enabled [Hint: SSLProxyEngine]
[Mon Aug 04 00:03:51 2014] [error] proxy: HTTPS: failed to enable ssl support for [::1]:9443 (localhost)

如何配置 http 服务器与 HTTPS 服务器通信?

169810 次浏览

您的服务器会准确地告诉您需要什么: [Hint: SSLProxyEngine]

您需要在 Proxy指令之前将该指令添加到 VirtualHost:

SSLProxyEngine on
ProxyPass /primary/store https://localhost:9763/store/
ProxyPassReverse /primary/store https://localhost:9763/store/

请参阅文档了解更多细节。

在我的例子中,我的服务器被配置为仅在 https 模式下工作,并且在尝试访问 http 模式时发生错误。因此,将 http://my-service改为 https://my-service有所帮助。