Diable default vhost in Nginx web server

When hosting a website in Nginx, the Nginx server will serve all the page to port 80 by default, in order to disable this features, you may create a default site which bind to the IP at port 80 and redirect it to the error page, which mean that’s no default page serving to the visitor

 

Return the status code of 444

server {
    listen      80 default_server;
    server_name _;
    return      444;
}

Deny the request call to the server

server {
  listen 80 default_server;
  server_name _;
  deny all;
}

 

Leave a Reply

google.com, pub-3772983857049267, DIRECT, f08c47fec0942fa0
%d bloggers like this: