NGINX: how to set the default virtual host
NGINX uses "listen" and "server_name" directives to define a virtual host. A web server virtual host denotes the part in the configuration that specifies what domain to serve based on the "Host:" attribute in the HTTP/1.1 request header sent by the client (browser).
In some cases, NGINX receives requests on the IP address that it listens for domains that it does not host or the IP address. To serve all these requests from a default virtual host, create another vhost section ("server { }") with following "listen" and "server_name" settings:
Code:
server {
...
listen 10.1.22.3:80 default_server;
...
server_name _;
...
}
And use a root directory with a nice 404.html page as index.
Reference: NGINX Server Names
http://nginx.org/en/docs/http/server_names.html