2017-02-20 246 views
1

我已经在这里和互联网上做了相当数量的浏览,但是我无法配置我的apache来将代理https转换为http。但我觉得我很接近。我所遵循的所有例子似乎都适用于除我之外的所有人,我的设置非常简单。Apache反向代理https https

<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中进行了设置。

+0

什么是错误日志或访问日志说? –

+0

我没有看到太多。我对你的评论进行了第二次观察,并且access_log显示404试图转到“http:// myserver /”,error_log中有警告级别消息关于基于名称的SSL虚拟主机仅适用于具有TLS服务器名称的客户端指示支持。 – Justin

+0

你可以检查apache是​​否为该端口服务? netstat或nmap? –

回答

1

事实证明,一些时髦的事情正在与443港口进行。

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

因此,我切换端口和以下是配置,最终得到我的反向代理到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>