1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

「nginx: [warn] the "listen ... http2" directive is deprecated...」への対応

Posted at

はじめに

Nginxの設定ファイル確認時に出た警告と、その対応について書きます。

環境

  • Rocky Linux 9.4
  • Nginx 1.26.0

警告の内容

Nginx 1.25.1でlisten ... http2ディレクティブが非推奨になり、$ nginx -tで設定ファイルを確認すると、以下のような警告が出ます。

$ sudo nginx -t
nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in {confファイル名}:2

対処法

エラーメッセージの通り、http2ディレクティブを設定します。

修正前
server {
  listen 443 ssl http2;
  ...(後略)
}
修正後
server {
  listen 443 ssl;
  http2 on;
  ...(後略)
}

おわりに

上記の修正で問題なく$ nginx -tが成功しました。

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?