Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides
https://forum.ivorde.com/

NGINX: how to set the default virtual host
https://forum.ivorde.com/nginx-how-to-set-the-default-virtual-host-t15921.html
Page 1 of 1

Author:  mandrei99 [ Thu Dec 12, 2013 6:01 am ]
Post subject:  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

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/