nginx reuseport duplicate listen options ?

George nginx-forum at forum.nginx.org
Mon Jul 30 21:14:18 UTC 2018


I know that nginx reuseport is only usable per ip:port pair so I am confused
about this error.

I have 3 nginx vhosts

vhost #1

server {
  listen 443 ssl http2 default_server backlog=2048 reuseport;
}

vhost #2

server {
  listen 80 default_server backlog=2048 reuseport fastopen=256;
}

vhost #3

server {
  listen 443 ssl http2;
}

This configuration works and I see socket sharding in use on 8 cpu thread
centos 7.5 64 server 

ss -lnt | egrep -e ':80 |:443 '
LISTEN     0      2048         *:443                      *:*               
  
LISTEN     0      2048         *:443                      *:*               
  
LISTEN     0      2048         *:443                      *:*               
  
LISTEN     0      2048         *:443                      *:*               
  
LISTEN     0      2048         *:443                      *:*               
  
LISTEN     0      2048         *:443                      *:*               
  
LISTEN     0      2048         *:443                      *:*               
  
LISTEN     0      2048         *:443                      *:*               
  
LISTEN     0      2048         *:80                       *:*               
  
LISTEN     0      2048         *:80                       *:*               
  
LISTEN     0      2048         *:80                       *:*               
  
LISTEN     0      2048         *:80                       *:*               
  
LISTEN     0      2048         *:80                       *:*               
  
LISTEN     0      2048         *:80                       *:*               
  
LISTEN     0      2048         *:80                       *:*               
  
LISTEN     0      2048         *:80                       *:* 

but if i had the 3 nginx vhosts where reuseport was used on vhost #3 instead
of vhost #2, i get error 

'nginx: [emerg] duplicate listen options for 0.0.0.0:443 in'



vhost #1

server {
  listen 443 ssl http2 default_server backlog=2048;
}

vhost #2

server {
  listen 80 default_server backlog=2048 reuseport fastopen=256;
}

vhost #3

server {
  listen 443 ssl http2 reuseport;
}

nginx 1.15.3 and 1.15.2 with GCC 7.3.1/8.2 or OpenSSL 1.1.0h/1.1.1-pre8 all
result in same error 'nginx: [emerg] duplicate listen options for
0.0.0.0:443 in' ???

nginx -V
nginx version: nginx/1.15.3 (260718-233400)
built by gcc 8.2.0 (GCC) 
built with OpenSSL 1.1.1-pre8 (beta) 20 Jun 2018
TLS SNI support enabled
configure arguments: --with-ld-opt='-L/usr/local/lib -ljemalloc -Wl,-z,relro
-Wl,-rpath,/usr/local/lib' --with-cc-opt='-I/usr/local/include -m64
-march=native -DTCP_FASTOPEN=23 -g -O3 -Wno-error=strict-aliasing
-fstack-protector-strong -flto -fuse-ld=gold --param=ssp-buffer-size=4
-Wformat -Werror=format-security -Wimplicit-fallthrough=0 -fcode-hoisting
-Wno-cast-function-type -Wp,-D_FORTIFY_SOURCE=2
-Wno-deprecated-declarations' --sbin-path=/usr/local/sbin/nginx
--conf-path=/usr/local/nginx/conf/nginx.conf --build=260718-233400
--with-compat --with-http_stub_status_module --with-http_secure_link_module
--add-dynamic-module=../nginx-module-vts --with-libatomic
--with-http_gzip_static_module --add-dynamic-module=../ngx_brotli
--with-http_sub_module --with-http_addition_module
--with-http_image_filter_module=dynamic --with-http_geoip_module
--with-stream_geoip_module --with-stream_realip_module
--with-stream_ssl_preread_module --with-threads --with-stream=dynamic
--with-stream_ssl_module --with-http_realip_module
--add-dynamic-module=../ngx-fancyindex-0.4.2
--add-module=../ngx_cache_purge-2.4.2 --add-module=../ngx_devel_kit-0.3.0
--add-dynamic-module=../set-misc-nginx-module-0.32
--add-dynamic-module=../echo-nginx-module-0.61
--add-module=../redis2-nginx-module-0.15
--add-module=../ngx_http_redis-0.3.7 --add-module=../memc-nginx-module-0.18
--add-module=../srcache-nginx-module-0.31
--add-dynamic-module=../headers-more-nginx-module-0.33
--with-pcre=../pcre-8.42 --with-pcre-jit
--with-zlib=../zlib-cloudflare-1.3.0 --with-http_ssl_module
--with-http_v2_module --with-openssl=../openssl-1.1.1-pre8
--with-openssl-opt='enable-ec_nistp_64_gcc_128 enable-tls1_3'

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,280710,280710#msg-280710



More information about the nginx mailing list