首页 > 解决方案 > 带有 Apache 反向代理 http2 的 NGINX 网络服务器

问题描述

我已将我的 Apache 配置为反向代理。现在我想启用 http2 来加速它。

Apache 已启用该模块,Nginx 也已启用。

当我进入

Protocols h2 h2c http/1.1
ProtocolsHonorOrder Off

ProxyPass / h2://192.168.2.100/
ProxyPassReverse / https://192.168.2.100/

进入 apache 站点配置,Nginx 抛出 400 Bad Request Error。

改为使用此代码:

Protocols h2 h2c http/1.1
ProtocolsHonorOrder Off
ProxyPass / https://192.168.2.100/
ProxyPassReverse / https://192.168.2.100/

Nginx 配置:

listen 443 ssl http2;

我需要如何配置此部分才能正常工作?#

标签: apachenginxproxyreverse

解决方案


我意识到这篇文章已经有一年多了,但是在将 nginx 升级到 1.20.1 后我遇到了类似的问题。事实证明,当使用 HTTP2 时,nginx 正在从 Apache 接收多个 Host 标头。添加 RequestHeader unset Host 解决了这个问题。


推荐阅读