Best way to prevent default server?
Solution 1:
Define a default_server that returns an HTTP 444 code:
server {
listen 80 default_server;
server_name _;
return 444;
}
(Returning a 4xx error code means requests can be interpreted by a client as an unsuccessful request, rather an HTTP 200 Blank Page But Totally Worked Trust Me.)
Solution 2:
Just define default vhost that will point to directory with blank index.html file.
server {
listen 80 default_server;
server_name _ ;
root /var/www/placeholder ;
index index.html;
}
and place blank index in /var/www/placeholder