Score:1

nginx: [warn] protocol options redefined

it flag

I'm updated nginx to 1.23.4, and nginx -t start showing warnings:

nginx: [warn] protocol options redefined for 0.0.0.0:443 in /etc/nginx/sites-enabled/beta:5
nginx: [warn] protocol options redefined for [::]:443 in /etc/nginx/sites-enabled/default:28
nginx: [warn] protocol options redefined for [::]:443 in /etc/nginx/sites-enabled/grafana:5

These lines are

    listen 443 ssl;
    listen [::]:443 ssl;
# sometimes:
#    listen 443 ssl;
#    listen [::]:443;
# I'm now know - some inconsistency, fixed

But after tweaking and adding http2 there were more warnings.

Score:2
it flag

It turned out that I didn't correct the configuration enough. Corrections must be made on all servers configurations.

To find all the wrong occurrences, you can help yourself:

grep -R /etc/nginx/ -e 443 |grep -v ssl
grep -R /etc/nginx/ -e 443 |grep -v http2

Important: All servers listening on the same port should have identical configuration.

eg.:

listen 443 ssl http2;

#bad:  ssl without http2
listen 443 ssl; 

#ok:   identical protocols as in previous (first) server
listen 443 ssl http2; 

More details are in commit: https://github.com/nginx/nginx/commit/dad65f3e449f215469943628f2b1f12a118fcf7e

lrkwz avatar
mv flag
which corrections did you apply?
bato3 avatar
it flag
Some servers I had defined as `443 ssl` others `443 ssl http2`. After fix all are `443 ssl http2`
Score:0
sg flag

It appears that the message shows each time that the nginx configuration processor encounters a listen directive for a given ip address & port combination that is different to the previous one it saw.

So if you have two consecutive server blocks that have the same listen directive then you will NOT get a warning for the second one. If the server block that follows that has a different listen directive (e.g. the same as the first one) then that will trigger another warning.

Ultimately, the solution is to make sure they are all the same, but I hope this extra detail helps somebody somewhere narrow down which of their configuration files they should change.

bato3 avatar
it flag
More details in nginx commit: https://github.com/nginx/nginx/commit/dad65f3e449f215469943628f2b1f12a118fcf7e
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.