nginx default server not used

Ruslan Ermilov ru at nginx.com
Wed Jun 13 06:12:45 UTC 2012


On Sat, Jun 09, 2012 at 04:41:23AM -0400, valinor wrote:
> Hello
> 
> I have found another possible cause for nginx to ignore default server
> I have encountered it just now, and it is not your case, but maybe it
> would be helpful for someone
> 
> At example:
> 
> server {
>   listen 80 default_server;
>   server_name default.domain.dom;
> ................
> }
> 
> server {
>   listen <particular.ip>:80;
>   server_name some.server.domain.dom;
> ..................
> }
> 
> In this case, listening schema for the default server is _not_the_same_
> as for another server.
> Considering the fact that we have described a server with the particular
> ip address, our default server for that ip (although it is listening on
> all IPs) would be ignored, and all queries to that particular ip, even
> with "Host: default.domain.dom", would be directed to
> "some.server.domain.dom" as it becomes a default (first-described)
> server for this listening schema.
> We have to explicitly describe "listen <particular.ip>:80" on the
> default server to enable it for this schema.
> 
> WBW, valinor

Here, you have two different listening addresses, 0.0.0.0:80 and
<particular.ip>:80.  Each of them may have its own "default server".
See here for details:
http://nginx.org/en/docs/http/request_processing.html#mixed_name_ip_based_servers



More information about the nginx mailing list