When you’ve recently upgraded your Nginx to version 1.25, you might notice that Nginx has altered the HTTP module. One significant change is the depreciation of the additional HTTP2 parameter on the “listen” directive. Instead, you’re advised to use the new “http2” directive. If you are using HTTP2, this new deprecation will affect you.
When your Nginx configuration still includes the old directive, you’ll receive a warning message like this:
nginx:[warn] the “listen … http2” directive is deprecated, use the “http2” directive instead in /etc/nginx/sites-available/yourconfigurationfile.
What Does This Warning Mean?
This warning message alone won’t disrupt your website. But it’s telling you to prepare for the future. Since this directive is now deprecated, an upcoming Nginx update might eliminate the “listen” directive entirely, which could potentially break your site.
How to Fix It Ahead of Time
To avoid any issues down the line, you need to adapt to the latest directive. Here’s a simple guide showing the before and after changes for easy reference:
listen 443 ssl http2; listen [::]:443 ssl http2;
listen 443 ssl; listen [::]:443 ssl; http2 on;
That’s all there is to it! You just have to declare “http2” and turn it on.