Hello Nginx users.
I was setting up my first Nginx server a few moments ago, and found a very strange problem.
Just to let you all know, I have set a wildcard A-record for my domain and therefore all subdomains point towards my Nginx server.
I have several subdomains set up for my own purposes and have them all declared in the following way:
server_name subdomain.domain.tld;
root /var/www/domain/subdomain/public_html;
under a server { declaration for each of them.
My problem is that, even if I have only declared sd1.domain.tld and sd2.domain.tld, Nginx will always show the contents of sd3.domain.tld with the content being that of the last declared subdomain which in this case would be sd2.domain.tld.
I would expect a non-declared subdomain to not show anything at all and return an error or a 404 page.
Has anyone encountered such a problem and if so what is the solution?
I have searched online but have not found a solution so far.
Thank you in advance!