server blocks configured, but getting "hello world" of nginx

Valentin V. Bartenev vbart at nginx.com
Mon Feb 3 20:12:20 UTC 2014


On Monday 03 February 2014 11:48:41 Josh Stratton wrote:
> > or to the first one in the configuration if there is no such
> > parameter.
> 
> As if all the server blocks are configured together?  That sounds really
> strange to me, that one server block could be the default for another
> server block.

They all are configured together since they share the same address:port pair. 
The only separation that server can make is based on requested host, but what 
if there is no matches among configured server names? Then nginx picks one
based on a simple rule I already mentioned.

And there is no magic in placing them in different configuration files (in fact, 
that "sites-available" thing is just a debian way of splitting web server 
configuration), they could be configured in one file as well.


> 
> # rgrep default_server /etc/nginx/
> /etc/nginx/sites-available/strattonbrazil.com:  #listen [::]:80
> default_server ipv6only=on;
> /etc/nginx/sites-available/morebearsmore.com:  #listen [::]:80
> default_server ipv6only=on;

Note, that you have "default_server" for IPv6 only, but your listen directives
for IPv4 haven't got this parameter.

  wbr, Valentin V. Bartenev



More information about the nginx mailing list