Nginx [1.25.1][warn] the listen http2 directive is deprecated, use the http2 directive instead

Published on

Just updated a server which upgraded nginx to 1.25.1 and while checking the status of nginx web server the following message is popping up for my all server directives.

It says: The “listen…http2” directive is deprecated, use the “http2” directive instead.

nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead.

The solution is very easy. It says the flag “http2” we use in listen directive has been changed to a dedicated directive, so move the flag to directive with yes flag.

It will give us control of yes and no flag.

Just convert the formatting from this …

server {
listen ssl http2;

… to this: (the new format for nginx version >= 1.25.1)

server {
listen ssl;
http2 on;

Now test and restart the nginx web server.

sudo nginx -t
sudo systemctl restart nginx

If you are using some template for server blocks, just update this everywhere.

Published in: .

Leave a Reply

Your email address will not be published. Required fields are marked *