Quantcast
Viewing latest article 17
Browse Latest Browse All 4759

Mixing listen directives in http/server

Hi, all. After the upgrade to nginx 1.26.2 I started facing this warning:

nginx: [warn] protocol options redefined for 0.0.0.0:443 in /path/to/123456.conf:8

Here's how configuration is laid out. There's one http clause under which a number of name-based servers are included from /path/to/*.conf and then comes this server:

server {
listen 80 default accept_filter=httpready rcvbuf=8k;
location / { deny all; }
}
server {
listen 443 ssl default_server accept_filter=dataready;
ssl_certificate ssl/self-ssl.crt;
ssl_certificate_key ssl/self-ssl.key;
ssl_stapling off;

location / { deny all; }
}

/path/to/*.conf files look like this:

server {
http2 on;
listen 80;
listen 443;
...

I can put ssl after 443 - it doesn't matter, it will still give the same warning. If I duplicate the listen clause from http

listen 443 ssl accept_filter=dataready;

nginx errs out with:
nginx: [emerg] duplicate listen options for 0.0.0.0:443 in /path/to/nginx.conf:47

If I completely remove listen directives from /path/to/*.conf, the said name based hosts aren't found resulting in HTTP 403.

So how do I get it working without warnings? For some reason listen 80 is ok, nginx doesn't complain about it at all.

Thanks.

Viewing latest article 17
Browse Latest Browse All 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>