server_name behaviour

Igor Sysoev igor at sysoev.ru
Mon Sep 13 23:31:38 MSD 2010


On Mon, Sep 13, 2010 at 10:19:34PM +0300, Gena Makhomed wrote:

> On 13.09.2010 21:53, Igor Sysoev wrote:
> 
> > Please read this:
> > http://nginx.org/en/docs/http/server_names.html#miscellaneous_names
> 
> but "server_name  _;" directive is no more required
> in catch-all server for nignx version 0.8.48 and newer.
> 
> ======================================================================
> 
> In catch-all server examples you may see the strange name “_”:
> 
> server {
>      listen       80  default_server;
>      server_name  _;
>      return       444;
> }
> 
> There is nothing special about this name, it is just one of a myriad of 
> invalid domain names which never intersect with any real name. You may 
> also use something like “--”, “!@#”, and so on.
> 
> ======================================================================
> 
> and nginx users should not use hack "server_name  _;" in 0.8.48+ (?)
> probably this documentation fragment is slightly out-of-date ?

It probably requires some rewording, but I think if a reader reads from
the start of "Miscellaneous names" section, he should understands "_" usage.
An empty name may be a good server name, which should not handled by
default server. 


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list