server_name in nginx.conf seems to be ignored [duplicate]
In short: by removing the production domainname requests for that domain do not get blocked, they will go to default server.
Paraphrased from the manual:
Nginx tests only the request’s header field “Host” to determine which server the request should be routed to. If its value does not match any server name, or the request does not contain this header field at all, then nginx will route the request to the default server. Unless explicitly configured with
default_server
the default server is the first one.
You could create a minimal default server that either returns a default page or an error message e.g.:
server {
listen 80 default_server;
server_name _ ;
return 503 "No server is currently configured for the requested host." ;
}