【问题标题】:Apache Reverse Proxy https to httpApache 反向代理 https 到 http
【发布时间】:2017-07-10 06:39:12
【问题描述】:

我在这里和 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。

【问题讨论】:

  • 什么是错误日志或访问日志?
  • 我没看到太多。在您的评论之后,我再次查看,access_log 显示 404 试图转到“myserver”,error_log 中有一条警告级别消息,关于基于名称的 SSL 虚拟主机仅适用于具有 TLS 服务器名称指示支持的客户端。
  • 你能检查一下 apache 服务于那个端口吗? netstat 还是 nmap?
  • 如果这是您的要求,它正在监听 443?
  • httpd 正在监听 443,nmap 显示我的服务器已打开该端口。

标签: apache ssl reverse-proxy


【解决方案1】:

结果发现 443 端口发生了一些奇怪的事情。

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

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

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

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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-24
    • 1970-01-01
    • 2016-09-30
    • 1970-01-01
    • 2018-03-08
    • 2013-04-02
    • 1970-01-01
    • 2020-05-19
    相关资源
    最近更新 更多