server name rewrite

Francis Daly francis at
Wed Jun 19 21:27:40 UTC 2013

On Wed, Jun 19, 2013 at 09:22:11PM +0300, wishmaster wrote:

Hi there,

> From I use two server's {} directives for this instead if().

> But this doesn't work and first server {} directive MUST have listen directive as well.

A request comes to an ip:port. nginx chooses the set of best-match servers
for that ip:port. A request indicates which Host: it cares about. nginx
chooses the one matching server from that set of servers.

Which means (approximately): if you want all possible server{} blocks to
be available to match a request, they should all have the same "listen"

>  So, or I am do something wrong or wiki-page doesn't clear describe this situation?

That wiki page section doesn't any "listen" directives. I imagine the
author thought that that aspect was out of scope for that document.

Francis Daly        francis at

More information about the nginx mailing list