Apache 反向代理 https 到 http

Apache Reverse Proxy https to http

我已经在此处和 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 并显示一个测试 index.html 我在 DocumentRoot 中进行了设置。

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

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

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

Nexus returns 带有 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>