I have a domainname (say: example.com) for which i set the DNS records like this:
*.example.com A IP_ADDRESS
example.com A IP_ADDRESS
www.example.com CNAME example.com
This means all requests for this domain (including subdomains) will be routed to my server with address IP_ADDRESS.
On my server I have an nginx http server running, with server settings like this:
server {
server_name demo.example.com;
// Location blocks here
}
The behaviour I expect is that the site will only be shown when demo.example.com, while going to anything.example.com or just example.com will result in nginx giving an error.
But this is not the case, what I am actually seeing is that while i have my server_name specifically set to demo.example.com, all requests on every subdomain for this domain will route to this site. So going to anything.example.com will result in seeing the site which I only want to show when going to demo.example.com.
So, I suspect I am just being stupid here and I've misconfigured something, but could someone please tell me how to get what I expect?