Nginx's default virtual host takes effect when a user accesses through IP or through a domain name that is not set (such as when someone points his own domain name to your IP).
For example, when someone accesses your website via IP or unknown domain name, you want to suppress any valid content and return 444 to him.
At present, many domestic computer rooms are required to shut down the main web site, to prevent the North shore of the domain name point to cause trouble.
You can set it this way:
1. Direct 301 or return 444
server {
Listen default_server;
server_name _;
return 444;
}
2. You can also collect these traffic, import to their own website, as long as the following jump settings can be:
server {
Listen default_server;
server_name _;
return http://www.111cn.net $request _uri;
}
Two solutions: Nginx's default virtual host takes effect when a user accesses via IP, or through a domain name that is not set (such as when someone points his own domain name to your IP).
Set up prohibit IP and unbound domain name access
Add the following code to the configuration file (whole paragraph)
① return 500 error
server {
Listen default;
server_name _;
return 500;
}
② jump to their own domain name home
Server {
listen default;
server_name _;
Rewrite ^ (. *) http://www.111cn.net permanent;
}
Step3 nginx
This way, the domain name that is not bound in Nginx and IP access will return 500 errors or jump to my domain first