You are not logged in.
Pages: 1
I'm trying to update my nginx configs to use the "http2 on;" syntax, as opposed to the deprecated "listen ... http2;" syntax in the server block.
I keep getting an error 'unknown directive "http2" in <file>'.
The nginx docs (https://nginx.org/en/docs/http/ngx_http … html#http2) say nginx needs to be built with "--with-http_v2_module" which I have verified on the nginx pkgbuild.
(I am not using mainline).
Section 3.2.3.1 of the nginx wiki page even has a sample server block with "http2 on;" in it.
I'm at a loss of what the issue could be.
Any ideas of where else I could look?
I am also getting a warning that 'protocol options redefined for 0.0.0.0:443 in <file>' but I only found comments online that that would stem from different sites being http2 "on" and others "off" on the same host.
I've disabled all other sites for debugging.
Last edited by feinedsquirrel (2023-09-09 07:24:24)
Offline
Hi, what comes back as a message when you run?
nginx -tLast edited by the-default (2023-09-09 06:28:28)
Offline
It works for me. So it should be your nginx build or some other issue with your configuration.
A quick and dirty way to check the binary.
$ strings /usr/bin/nginx | grep http2
…
http2 new hpack table size: %uz was:%uz
http2 send WINDOW_UPDATE frame sid:%ui, window:%uz
http2 send RST_STREAM frame sid:%ui, status:%ui
http2 send GOAWAY frame: last sid %ui, error %ui
http2 close stream %ui, queued %ui, processing %ui
http2 retry close stream handler
…It should show plenty of lines starting with http2 (if the http2 module is enabled).
It should also have this line:
the "listen ... http2" directive is deprecated, use the "http2" directive insteadAt this point it should also support the 'http2 on' option... since these changes were made in the same commit:
https://github.com/nginx/nginx/commit/a … 8aab5b0f4e
From the looks of it, it should not be possible for nginx to emit this warning message, when the build doesn't actually support it… it would instead complain about missing http2 module for the 'listen ... http2' variant as well.
Last edited by frostschutz (2023-09-09 06:35:22)
Offline
major :facepalm:
$ strings /usr/bin/nginx | grep http2It doesn't have the line that you mention it should have.
Reading the nginx documentation again, it is clearly stated
This directive appeared in version 1.25.1
I read that block I don't know how many times, and I even had printed out
$ nginx -v
nginx version: nginx/1.24.0paying attention to the fact I am running nginx, not nginx-mainline.
I guess I was flipping between too many pages and configs, and not following through with my train of thought, making sure that directive was in my installed version.
I apologize for the wasted time, and I greatly appreciate you both collectively getting me to look at the right info in the correct sequence.
I'll update my configs once the "nginx" package is bumped to a version later than 1.25.1.
On the upside, I learned the "strings" command. Another tool in my box. Silver linings.
Marking solved.
Offline
Pages: 1