Apache 反向代理 https 到 http

标签 apache ssl reverse-proxy

我已经在此处和 Internet 上进行了大量浏览,但我无法配置我的 apache 以将代理 https 反向代理到 http。但是我觉得我很接近。我遵循的所有示例似乎都适用于除我之外的所有人,而且我的设置非常简单。

<VirtualHost *:443>
ServerName myserver
SSLEngine On
SSLCertificateFile /path/to/file
SSLCertificateKeyFile /path/to/file
SSLCertificateChainFile /path/to/file
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
    AddDefaultCharset Off
    Order deny,allow
    Allow from all
</Proxy>
ProxyPass / http://myserver:8081/
ProxyPassReverse / http://myserver:8081/

ErrorLog logs/myserver-error_log
CustomLog logs/myserver-access_log common
</VirtualHost>

所以当我去 https://myserver/我希望它重定向到运行 Nexus 的那个端口。

在我使用 SSL 之前,这实际上适用于 VirtualHost *:80。我可以去 http://myserver/并最终在 Nexus。不确定为什么 https 不起作用。

实际发生的是 https://myserver/转到 https://myserver并显示我在 DocumentRoot 中设置的测试 index.html。

最佳答案

原来 443 端口发生了一些奇怪的事情。

httpd 正在监听该端口,来自另一台机器的 nmap 命令显示 443 打开但出于某种原因,但是 RHEL 7 的 VM 已设置,它无法正常工作。

所以我切换了端口,下面是最终让我的反向代理到 https 到 apache 和 http 到我的 Nexus 存储库的配置。

Nexus 返回一个带有 http 链接的网页,该链接中断获取该页面的内容,但我只需要用于不会请求网页的 docker 守护程序的 SSL。

Listen 8082
<VirtualHost *:8082>
ServerName myserver
SSLEngine On
SSLCertificateFile /path/to/file
SSLCertificateKeyFile /path/to/file
SSLCertificateChainFile /path/to/file
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://myserver:8081/
ProxyPassReverse / http://myserver:8081/

ErrorLog logs/myserver-error_log
CustomLog logs/myserver-access_log common
</VirtualHost>

关于Apache 反向代理 https 到 http,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42353793/

相关文章:

php - 在 wampserver 3.0.6 上安装 imagick

javascript - Node.js + Express.js + SSL

python - 使用 python 3.5 和 urllib 禁用 SSL 身份验证

apache 客户端身份验证 - 将客户端证书的指纹设置为 header 值

soap - WildFly 8.2.0,使用反向代理的 JBossWS 生成不正确的 httpssoap :address

reverse-proxy - Varnish :性能影响大禁止列表

node.js - Apache 反向代理 NodeJS WebSocket 服务器

apache - 与 Apache 服务器的空闲套接字连接超时时间

mysql - 使用用户名和密码配置 phpMyAdmin 不允许登录

apache - 如何在 docker apache httpd 中安装 mod_pagespeed