在Apache中启用HTTP2 2.4.53

发布于 2025-01-21 07:12:14 字数 2183 浏览 2 评论 0 原文

阅读此 link ,很明显,很明显,很明显, HTTP2 Prefork 不一起工作。我正在尝试通过在 mpm 中禁用 prefork 来解决这个问题。

我去更改了 httpd-mpm.conf ,并评论了以下语句:

<IfModule mpm_prefork_module>
    #StartServers             5
    #MinSpareServers          5
    #MaxSpareServers         10
    #MaxRequestWorkers      250
    #MaxConnectionsPerChild   0
</IfModule>

在我的httpd.conf文件中,我已经启用了模块

LoadModule http2_module modules/mod_http2.so

并添加了以下配置:

Protocols h2 h2c http/1.1
H2Direct on

我看到错误日志中没有错误如下:

[Thu Apr 14 23:03:59.295852 2022] [ssl:warn] [pid 18592:tid 220] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Apr 14 23:03:59.297852 2022] [mpm_winnt:notice] [pid 18592:tid 220] AH00455: Apache/2.4.53 (Win64) OpenSSL/1.1.1n configured -- resuming normal operations
[Thu Apr 14 23:03:59.297852 2022] [mpm_winnt:notice] [pid 18592:tid 220] AH00456: Apache Lounge VS16 Server built: Mar 16 2022 11:26:15
[Thu Apr 14 23:03:59.298852 2022] [core:notice] [pid 18592:tid 220] AH00094: Command line: 'httpd.exe -d C:/Users/naraadia/.softwares/Apache24_2.4.53'
[Thu Apr 14 23:03:59.320854 2022] [mpm_winnt:notice] [pid 18592:tid 220] AH00418: Parent: Created child process 14840
[Thu Apr 14 23:04:00.406963 2022] [ssl:warn] [pid 14840:tid 228] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Apr 14 23:04:00.449967 2022] [mpm_winnt:notice] [pid 14840:tid 228] AH00354: Child: Starting 64 worker threads.

服务器提供的我的所有页面都没有开发人员工具中的 http2 H2 协议。所有页面都有 http/1.1 协议。是否有更好的方法来实现正在推动HTTP2协议?我觉得前叉仍然没有残障。

我已经下载了服务器zip文件,但没有编译服务器。

编辑1 :阅读 mod_http2 文档后,很明显,正在使用 winnt MPM策略。

我试图检查 curl 是否有助于确定是否启用了HTTP2,但是当我运行时,

curl -I --http2 http://localhost:8083 | findstr HTTP

它却一无所获。

谁能帮助启用HTTP2或帮助确定缺少什么?

After reading this link, it's clear that HTTP2 and prefork don't work together. I am trying to get around this issue by disabling prefork in MPM.

I went and changed the httpd-mpm.conf and commented out the following statements:

<IfModule mpm_prefork_module>
    #StartServers             5
    #MinSpareServers          5
    #MaxSpareServers         10
    #MaxRequestWorkers      250
    #MaxConnectionsPerChild   0
</IfModule>

and in my httpd.conf file i have enabled the module

LoadModule http2_module modules/mod_http2.so

and added the following configuration:

Protocols h2 h2c http/1.1
H2Direct on

I see no errors in my error log which are as follows:

[Thu Apr 14 23:03:59.295852 2022] [ssl:warn] [pid 18592:tid 220] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Apr 14 23:03:59.297852 2022] [mpm_winnt:notice] [pid 18592:tid 220] AH00455: Apache/2.4.53 (Win64) OpenSSL/1.1.1n configured -- resuming normal operations
[Thu Apr 14 23:03:59.297852 2022] [mpm_winnt:notice] [pid 18592:tid 220] AH00456: Apache Lounge VS16 Server built: Mar 16 2022 11:26:15
[Thu Apr 14 23:03:59.298852 2022] [core:notice] [pid 18592:tid 220] AH00094: Command line: 'httpd.exe -d C:/Users/naraadia/.softwares/Apache24_2.4.53'
[Thu Apr 14 23:03:59.320854 2022] [mpm_winnt:notice] [pid 18592:tid 220] AH00418: Parent: Created child process 14840
[Thu Apr 14 23:04:00.406963 2022] [ssl:warn] [pid 14840:tid 228] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Apr 14 23:04:00.449967 2022] [mpm_winnt:notice] [pid 14840:tid 228] AH00354: Child: Starting 64 worker threads.

and none of my pages being served by the server have HTTP2 or h2 protocol in developer tools. All the pages have http/1.1 protocol. Is there a better way to achieve HTTP2 protocol being pushed? I feel prefork is still not disabled.

I have downloaded the server zip file and not compiled the server.

EDIT 1 : After Reading the mod_http2 documentation, it's clear that winnt mpm strategy is being used.

I tried to check if curl helps in determining if HTTP2 is enabled or not but when I run

curl -I --http2 http://localhost:8083 | findstr HTTP

It returns nothing.

Can anyone help in enabling HTTP2 or help in determining what is missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

简单气质女生网名 2025-01-28 07:12:14

我去了httpd-mpm.conf,并评论了以下陈述:

这些陈述被包裹在&lt; ifModule mpm_prefork_module&gt; 中,因此仅在启用该模块时才使用。

编辑1:阅读MOD_HTTP2文档后,很明显,正在使用Winnt MPM策略。

没错。 Windows上的Apache使用其自己的MPM模块,该模块与HTTP/2兼容。

,服务器提供的我的所有页面都没有开发人员工具中的HTTP2或H2协议。所有页面都有HTTP/1.1协议。是否有更好的方法来实现正在推动HTTP2协议?我觉得前叉仍未被禁用。

浏览器仅支持HTTP/2在HTTPS上支持HTTP/2。看起来,从您的卷曲命令中,您仅使用未加密的HTTP,而不是使用HTTP。因此,即使您已经启用了 H2Direct - 客户端和服务器都需要支持它以工作,并且您只能在服务器上启用它,并且无法在浏览器上启用它,否则这也行不通。

我试图检查curl是否有助于确定http2是否启用了,但是当我运行时

  curl -I -HTTP2 http:// localhost:8083 |查找http
 

它没有返回。

在http上使用http/2(而不是https)需要,尽管这将被弃用。您应该使用 -http2-prior-knowledge 如果想在HTTP上使用HTTP/2,并且确定服务器支持它。

I went and changed the httpd-mpm.conf and commented out the following statements:

Those statments were wrapped in an <IfModule mpm_prefork_module> so would only be used if that module was enabled.

EDIT 1 : After Reading the mod_http2 documentation, it's clear that winnt mpm strategy is being used.

That's correct. Apache on windows uses it's own mpm module, which is compatible with HTTP/2.

and none of my pages being served by the server have HTTP2 or h2 protocol in developer tools. All the pages have http/1.1 protocol. Is there a better way to achieve HTTP2 protocol being pushed? I feel prefork is still not disabled.

Browsers only support HTTP/2 over HTTPS. Looks like, from your curl command, that you are only using unencrypted HTTP, rather than HTTPS. So this will not work, even though you have enabled H2Direct - both client and server need to support this to work and you have only enabled it on the server and cannot enable this on the browser.

I tried to check if curl helps in determining if HTTP2 is enabled or not but when I run

curl -I --http2 http://localhost:8083 | findstr HTTP

It returns nothing.

Using HTTP/2 over HTTP (rather than HTTPS) requires an upgrade header and round trip, though that is going to be deprecated. You should use --http2-prior-knowledge if wanting to use HTTP/2 over HTTP and are sure the server supports it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文