Nginx [warn] protocol options redefined for 0.0.0.0:443

NginxのWarningが出たので調査したときの覚書。

環境: CentOS Stream 8, nginx 1.24.0

下記エラーが表示された。
# nginx -t

nginx: [warn] protocol options redefined for 0.0.0.0:443 in /etc/nginx/conf.d/01_hoge.conf:72
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

listenにhttp2の記述がないとダメらしい。
参考: nginx: [warn] protocol options redefined - Server Fault

confファイルを検索してみる。
grepオプションの意味はhelpで確認。
# grep --help
# grep -rnw '/etc/nginx/conf.d/' -e '443 ssl;'

/etc/nginx/conf.d/00_default.conf:18:    listen       443 ssl;
/etc/nginx/conf.d/00_default.conf:67:    listen       443 ssl;

いくつかあった。

「443 ssl;」を「443 ssl http2;」に修正してnginx再起動。
# nginx -t
# systemctl restart nginx


【関連記事】