the "listen ... http2" directive is deprecated Nginx / Apache Origin: Edge & web server OSI layer 7 · Application Last updated 5 Nov 2026

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;.

Exact message you may see 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"
Seen on: Nginx Linux

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

  1. listen 443 ssl; http2 on; on Nginx 1.25.1+
  2. Keep listen ... http2 on older versions
  3. Check nginx -v

Detailed fix by platform

Nginx

  1. server { listen 443 ssl; listen [::]:443 ssl; http2 on; }

How to diagnose

  1. Version — 1.25.1+?
  2. Syntax — Old/new?
  3. 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:

Where this error sits

Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):

410 — HTTP 410 Gone (HTTP)410499 Client Closed Request / client prematurely closed connection — Nginx: [info] client prematurely closed connection while reading response header from upstream / access log status 499 (Nginx / Apache)499 Client Closed Req…accept4() failed (24: Too many open files) — Nginx: [crit] accept4() failed (24: Too many open files) / open() failed (24: Too many open files) (Nginx / Apache)accept4() failed (24:…ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY — Chrome: ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY — HTTP/2 requires a modern TLS cipher (SSL / TLS)ERR_HTTP2_INADEQUATE_…ModSecurity: Access denied with code 403 — Nginx/Apache: ModSecurity: Access denied with code 403 (phase 2). Matched "Operator GE matched 5 at TX:anomaly_score" (Nginx / Apache)ModSecurity: Access d…nginx: [emerg] unknown directive — Nginx: nginx: [emerg] unknown directive "x" in /etc/nginx/sites-enabled/x:12 — configuration file test failed (Nginx / Apache)nginx: [emerg] unknow…nginx: client intended to send too large body — Nginx: [error] client intended to send too large body: 5242880 bytes (413 Request Entity Too Large) (Nginx / Apache)nginx: client intende…SSL_CTX_set_tmp_dh failed: dh key too small — Nginx: [emerg] SSL_CTX_set_tmp_dh("/etc/ssl/dhparam.pem") failed (SSL: error:1401E0A8:SSL routines:... dh key too small) (SSL / TLS)SSL_CTX_set_tmp_dh fa…the "list…

Explore the map of this error Full error map →

🧠 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.