Nginx only allows some domain names to access other domain names and cannot access them all. how do I write this? For this problem can refer to the official document Incatch-allserverexamplesthestrangename_canbeseen: server {listen80default _... nginx only allow some domain names to access other will not be accessible, how to write? 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.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service