Apache 反向代理 https 到 http

Jus*_*tin 5 apache ssl reverse-proxy

我已经在这里和互联网上进行了大量浏览,但我无法将我的 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>
Run Code Online (Sandbox Code Playgroud)

因此,当我转到https://myserver/ 时,我希望它重定向到运行 Nexus 的那个端口。

在我做 SSL 之前,这实际上适用于 VirtualHost *:80。我可以访问http://myserver/并最终访问 Nexus。不知道为什么 https 不起作用。

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

Jus*_*tin 5

结果发现 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>
Run Code Online (Sandbox Code Playgroud)