Nginx only allows some domain names to access other domain names and cannot access them all. How do I write this? For this question, refer to the official document 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. the catch-all server instance shows that the strange name "_" server {listen 80 default_server; server_name _; return 404;} has nothing special, it is only one of the many invalid domain names that represents any real name, and will never meet each other. Other invalid names, such as "-" and "! @ # "Can also be used. Default_server: The nginx virtual Host uses the Host value in the HTTP request to find the corresponding virtual Host configuration. What if it cannot be found? Then nginx will send the request to the node with the default_server specified for processing, that is, when the Unbound Domain Name points to your server and the domain name of the VM you configured does not match, the VM is used by default, and 404 is returned directly. Add this configuration to your nginx. conf file.