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

**Code:** `the "listen ... http2" directive is deprecated` · **Category:** Nginx / Apache · **Seen on:** Nginx, Linux

Since Nginx 1.25.1 HTTP/2 is enabled with a separate `http2 on;` directive instead of `listen 443 ssl 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

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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/nginx-apache/nginx-http2-directive-deprecated)
