duplicate listen options for backlog directive for ip:80 and ip:443 pairs ?

Maxim Dounin mdounin at mdounin.ru
Sat Jun 1 14:47:57 UTC 2019


Hello!

On Fri, May 31, 2019 at 03:15:18AM -0400, George wrote:

> I am trying to troubleshoot a duplicate listen options error that only
> happens on one server and not the other.
> 
> From docs at http://nginx.org/en/docs/http/ngx_http_core_module.html backlog
> listen directive works for each ip:port pair so I should be able to set
> backlog directive on listen directive once on port 80 and once on port 443.
> But on one server I am not able to and can't see where the problem is coming
> from ? How shall I debug this ?

[...]

> --- not working ---
> Now on another Nginx 1.17.0 server I have 3 nginx vhosts but nginx restarts
> complain of duplicate listen options once I add vhost 3 and the error is
> related for vhost 2's listen directive
> 
> nginx: [emerg] duplicate listen options for 0.0.0.0:443 in
> /path/to/vhost2/vhost
> 
> vhost 1
> listen 80 default_server backlog=4095 reuseport fastopen=256;
> 
> vhost 2
> listen 443 ssl http2 reuseport;
> 
> vhost 3
> listen 443 ssl http2 backlog=4095;
> 
> if i remove vhost 3 backlog=4095 directive there's no error though ?

Both

   listen 443 ssl http2 reuseport;

and

   listen 443 ssl http2 backlog=4095;

specify listening socket options, "reuseport" and "backlog=4095".  
Socket options are only allowed to be specified once for a given 
listening socket, and nginx complains as you try to specify time 
twice.  You have to specify both on a single "listen" directive.

> Now if I reverse it so backlog=4095 is set in vhost 2 and not vhost 3, then
> it works and nginx doesn't complain of errors ? No idea why that is the case
> or if it's a bug ?
> 
> vhost 2
> listen 443 ssl http2 reuseport backlog=4095;
> 
> vhost 3
> listen 443 ssl http2;

That's exactly how it is expected to work.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list