Prevent Nginx From Processing Requests with Undefined Server Name
It makes me confused for a while, so I decide to write it down.
The first server block in the nginx config is the default for all requests that hit the server for which there is no specific server block.
A proper Nginx configs have a specific server block for defaults
http {
[...]
server {
listen 80 default_server;
server_name _;
return 444; # HTTP response that simply close the connection and return nothing
}
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
[References]