我已经在此处和 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/