I have an instance of nginx running which serves several websites. The first is a status message on the server\'s IP address. The second is an admin console on admin.d
server directiveFrom Nginx listen Docs
The default_server parameter, if present, will cause the server to become the default server for the specified address:port pair. If none of the directives have the default_server parameter then the first server with the address:port pair will be the default server for this pair.
If you only have 1 server directive, that will handle all request, you don't need to set anything.
server directiveIf you want to match all request with specified server directive, just add default_server parameter to listen, Nginx will use this server directive as default.
server {
listen 80 default_server;
}
server_name _;From Nginx Docs
In catch-all server examples the strange name “_” can be seen:
server { listen 80 default_server; server_name _; return 444; }There is nothing special about this name, it is just one of a myriad of invalid domain names which never intersect with any real name. Other invalid names like “--” and “!@#” may equally be used.
It doesn't matter what server_name you set, it is just an invalid domain name.