nginx: add http2 directive
☑️ Resolves
- Fix: the latest nginx 1.25.1 adds the http2 directive. The nginx conf of nextcloud needs to implement the changes to avoid any warnings or related errors.
Related Nginx docs:
- https://nginx.org/en/docs/http/ngx_http_core_module.html#listen
- https://nginx.org/en/docs/http/ngx_http_v2_module.html#http2
All correct, but I wonder whether it is too early for this commit, whether it makes more sense to switch it for now: Keep the example configs untouched and instead mention the new directive one for Nginx >=1.25.1 as bullet point.
This Nginx version is very new and all non-rolling-release distros do and will ship older Nginx for a longer while. The old directive is still functional on recent Nginx, so it will throw warnings but work, i.e. is most compatible. The new directive leads to a failure on older Nginx.
The example configs could be switched to the new directive (and then bullet point mentioning the old one) e.g. once the old one really leads to a failure with new Nginx.
I'm with @MichaIng. Also, as recent example, when the old ssl directive was deprecated in favor of the ssl parameter for listen it took >5 years and 10 1.x version bumps until it was removed entirely by NGINX. We need to maintain backwards compatibility, particularly where the only downside is a warning in more bleeding edge environments (see below). I prefer keeping the existing example configurations as universal as possible (i.e. at least until major distro LTS releases have bumped or are getting close). But I have no problem with adding a bullet point note about the deprecation so that people running newer versions of NGINX understand it's okay to change it.
nginx -t
nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in etc/nginx/nginx.conf :15
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful