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

Josh Stratton strattonbrazil at gmail.com
Mon Feb 3 20:32:53 UTC 2014


Right, I actually have those lines commented out.  That's the part I don't
understand.  For example, if I put everything in the same file (example
below), neither one of them have a default_server or a wildcard.  The only
other option I see from the link you sent me is www.morebears.com is
getting "defaulted" by nginx to the hostname.  However, I don't know what
about my server would default to strattonbrazil.com.  Based on the below
settings, I don't see how that should be happening and in my system
environment I don't see anything like `hostname` that would also direct to
strattonbrazil.com.

server {
listen 80;
#listen [::]:80 default_server ipv6only=on;

    root /var/www/morebearsmore.com/public_html;
 index index.html index.htm;
        ...
}

server {
listen 80;
 #listen [::]:80 default_server ipv6only=on;

    root /var/www/strattonbrazil.com/public_html;
 index index.html index.htm;
        ...
}


On Mon, Feb 3, 2014 at 12:12 PM, Valentin V. Bartenev <vbart at nginx.com>wrote:

> 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
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140203/eddee4e3/attachment.html>


More information about the nginx mailing list