Enable HTTP2 in Apache 2.4.53

1.6k views Asked by At

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?

1

There are 1 answers

0
Barry Pollard On

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.