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


95

我将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 server时会给出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服务器对话?

Answers:


204

您的服务器会告诉您所需的确切信息: [Hint: SSLProxyEngine]

您需要将该指令添加到您VirtualHostProxy指令之前:

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

有关详细信息,请参阅文档


6
谢谢,这工作完美。。我错过了SSLProxyEngine放在参数上。
Ratha 2014年

我的SSLProxyEngine处于打开状态,并且仍启用了ssl模块[2015年11月17日星期二12:19:39.061224] [代理:错误] [pid 8381:tid 140148180240128] AH00961:HTTPS:无法为182.161.73.67启用ssl支持: 443(gum.criteo.com)
Ashish

1
[2015年11月17日星期二12:19:40.322610] [ssl:error] [pid 5485:tid 140148287219456] [远程103.229.140.67:443] AH01961:要求localhost:80的SSL代理请求但未启用[提示:SSLProxyEngine]
Ashish Karpe 2015年

1
谢谢...只需在httpd-ssl.conf文件SSLProxyEngine on后添加即可,SSLEngine on就像魅力一样!
equiman'4

0

就我而言,我的服务器配置为仅在https模式下工作,并且在尝试访问http模式时发生错误。因此,改变http://my-servicehttps://my-service帮助。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.