Nginx: nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead
Since Nginx 1.25.1 HTTP/2 is enabled with a separate http2 on; directive instead of listen 443 ssl http2;.
the "listen ... http2" directive is deprecated, use the "http2" directive insteadnginx: [warn] the "listen ... http2" directive is deprecated[warn] the listen ... http2 directive is deprecatednginx [emerg] unknown directive "http2" Meaning
Replace listen 443 ssl http2; with listen 443 ssl; plus http2 on; in the server block. It's only a warning on 1.25.1+, but older versions don't know http2 on;, so keep the old syntax there.
Common causes
- Config written for Nginx < 1.25.1
- Upgrading nginx
- Certbot/templates using old syntax
- Docs copied from older guides
- Mixed versions across servers
⚡ Quick fix
listen 443 ssl; http2 on;on Nginx 1.25.1+- Keep
listen ... http2on older versions - Check
nginx -v
Detailed fix by platform
Nginx
server { listen 443 ssl; listen [::]:443 ssl; http2 on; }
How to diagnose
- Version — 1.25.1+?
- Syntax — Old/new?
- Templates — Updated?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 410 HTTP 410 Gone
- 499 Client Closed Request / client prematurely closed connection Nginx: [info] client prematurely closed connection while reading response header from upstream / access log status 499
- accept4() failed (24: Too many open files) Nginx: [crit] accept4() failed (24: Too many open files) / open() failed (24: Too many open files)
Most viewed in Nginx / Apache
- upstream timed out Nginx: upstream timed out (110: Connection timed out) while reading response header from upstream
- AH00558 Apache: AH00558: apache2: Could not reliably determine the server's fully qualified domain name
- nginx: host not found in upstream Nginx: nginx: [emerg] host not found in upstream "app" in /etc/nginx/conf.d/default.conf:5
Other ways to find it
Where this error sits
Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026