Nginx catching all domains without wildcard

My Nginx config is catching all subdomains without specifying a
wildcard. I
have created an special config for each subdomain, but seems that all
subdomains pass trough the main domain configuration. I have discovered
this by removing the subdomains configuration files from nginx.conf and
watching how it still catches all the subdomains, so when I send a
request
to uk.domain.com, instead of Nginx catching the subdomain configuration,
goes through the main domain configuration. This is causing trouble with
applying mod_pagespeed individually to each of the sites and also
managing
the GA universal code.
The config for the main domain is this :

http config :

If I haven’t setup a wildcard, how come the main domain config is
catching
all subdomains ??

Thanks

In the configuration you provided, there are 3 server blocks:

There is no server block defined for uk.domain.com (you main config file
has an include directive for a /etc/nginx/uk.domain.com file which is
commented though), thus a default server block will be selected.

On port 443, for all IP addresses, the domain.com server block will be
chosen as it is defined as being the default.
On port 80, there is no default port defined, thus the first (and only)
one
will be used.
On 8081 for the localhost IP address 127.0.0.1, as for 80, there is no
default port so the first (and only) server block defined for the
IP:port
pair will be selected as the default.

There is no magical behavior, please make sure you understand the docs.
There is even a webpage dedicated to server names:
Server names

B. R.

On Mon, Dec 28, 2015 at 3:52 AM, Xavier Cardil C. [email protected]