Welcome! Log In Create A New Profile

Advanced

Re: duplicate ports across servers in nginx.conf

All files from this thread

File Name File Size   Posted by Date  
nginx.conf 4.5 KB open | download Yuval Abadi via nginx 05/31/2023 Read message
Francis Daly
May 31, 2023 03:38AM
On Wed, May 31, 2023 at 06:14:41AM +0000, Yuval Abadi via nginx wrote:

Hi there,

I don't speak for the project, but my guess is:

> If the configuration has 2 servers sharing the same name and the same port
> I got this warning:
> "nginx: [warn] conflicting server name "http://www.mut.com/" on 0.0.0.0:80, ignored"
>
> Why not block this mistake?

If you have 20 server{}s, and 2 share the name and port, should the
entire system fail to start (or reload config)?

It seems friendlier to me to use the config as-provided, and alert on
things that are not used as the administrator apparently expected.

Some configuration issues are considered more important than some
others. This particular one is currently not considered "fatal".

> I assume the second server ignored, but why let it possible?

nginx does not control what the administrator types.

> If the servers do not have name
> I got this warning:
> nginx: [warn] conflicting server name "" on 0.0.0.0:9002, ignored
> nginx: [warn] conflicting server name "" on 0.0.0.0:80, ignored

Yes; it's the same message, showing the listen ip:port and server_name
values that are unexpected.

> both warning:
> first no way for NGINX gives good warning, both server looks the same.

I agree that it would be even friendlier if the error message indicated
the filename and line number that the unexpected configuration came from;
I suspect that a patch to change that would be thoughtfully considered.

Maybe someone will be interested in providing that patch, now that the
issue has been mentioned.

(Maybe the only reason the log omits the filename is that no-one thought
to add it here, where it is added in other places. Or maybe it is harder
than that to implement.)

> if user did such mistake, better to block.

I disagree.

It appears that the current code disagrees too; maybe that will change
in the future.

> Why not enforce using at list one server have "listen default_server port"?

I think that is enforced already -- if you have more than one
"default_server", you get an "emerg" failure. If you have none explicitly,
then the implicit config applies -- and I would rather not lose the
implicit config.

> Why not enforce server names , and not let more than one server with same name?

I think that is what it is doing already; it considers it a "warning"
rather than an "emergency" configuration issue.

> Is NGINX set the bit default_server ,on the first "ngx_http_conf_addr_t", of the first server, that read from conf file? (if no default_server was defined)?
>

I'm not quite sure what you are asking: if it is about the code, it
is not hidden and is quite readable; if it is about which server is
default_server if none is explicit, then the documentation also describes
that -- the "implicit" default_server for a specific ip:port is the first
server{} that was read with that (possibly implicit) "listen" config.

Cheers,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Reverse proxy to forward proxy to internet access

Miten Mehta May 25, 2023 07:44AM

Re: Reverse proxy to forward proxy to internet access

Francis Daly May 25, 2023 07:10PM

Re: Reverse proxy to forward proxy to internet access

Miten Mehta May 26, 2023 06:50AM

Re: Reverse proxy to forward proxy to internet access

Miten Mehta May 27, 2023 12:22AM

Re: Reverse proxy to forward proxy to internet access

Saint Michael May 27, 2023 12:40AM

Re: Reverse proxy to forward proxy to internet access

Francis Daly May 27, 2023 04:26AM

Re: Reverse proxy to forward proxy to internet access

Saint Michael May 27, 2023 10:44AM

Re: Reverse proxy to forward proxy to internet access

Francis Daly May 28, 2023 07:58AM

Re: Reverse proxy to forward proxy to internet access

Francis Daly May 27, 2023 04:14AM

Re: Reverse proxy to forward proxy to internet access

David Siembab May 28, 2023 12:00AM

Re: Reverse proxy to forward proxy to internet access

Saint Michael May 28, 2023 12:56AM

Re: Reverse proxy to forward proxy to internet access

Francis Daly May 27, 2023 03:50AM

Re: Reverse proxy to forward proxy to internet access

Miten Mehta May 29, 2023 07:06AM

duplicate ports across servers in nginx.conf

Yuval Abadi via nginx May 30, 2023 02:52AM

Re: duplicate ports across servers in nginx.conf

Francis Daly May 30, 2023 12:58PM

RE: duplicate ports across servers in nginx.conf Attachments

Yuval Abadi via nginx May 31, 2023 02:16AM

Re: duplicate ports across servers in nginx.conf

Francis Daly May 31, 2023 03:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 232
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready