Create default website in nginx
From DevOps Notebook
Default website in nginx is useful to close connection when someone tries to access to webserver via IP
which is shown in this example, but you can easily create redirect to real website or have custom page.
server {
listen 80 default_server;
server_name _; # This is invalid value which will match any host
access_log /var/log/nginx/default.access.log;
error_log /var/log/nginx/default.error.log;
server_name_in_redirect off;
root /var/www/html;
location ^~ / {
return 444; # to close connection
}
}