duplicate ports across servers in nginx.conf

Francis Daly francis at daoine.org
Tue May 30 16:57:19 UTC 2023

On Tue, May 30, 2023 at 06:50:19AM +0000, Yuval Abadi via nginx wrote:

Hi there,

> When I have 2 servers in nginx.conf  with same  listen port   if the server have name, nginx issue warning  ignore …  but nit failed to load.
> What happens is only the first server in conf binds the socket.
> And worse, If no server names I did not get a warning.

Does https://nginx.org/en/docs/http/request_processing.html explain what
you are seeing?

If not, can you show one small but complete configuration that shows
the problem that you are reporting?

"name-based virtual servers" are based around listening on the same
port, and having the http server responding differently based on the
Host: in the incoming request. It would be surprising if that feature
became broken.

The documentation for "listen" at https://nginx.org/r/listen does note
that some parameters only make sense when set once (or set the same each
time, if they are set more than once); I don't know if you are hitting
one of those cases?


Francis Daly        francis at daoine.org

More information about the nginx mailing list