Set the default virtual host (empty host header, default host header) for Nginx _nginx

Source: Internet
Author: User
The most important thing is to add this line to the server's settings:
Listen default;
The following default parameter indicates that this is the default virtual host.

This setting is very useful.
For example, when someone accesses your website via IP or unknown domain name, you want to suppress any valid content and return 500 to him.
At present, a lot of domestic computer rooms are required to shut down the main web site, to prevent the record of the domain name to cause trouble. You can set it this way:
Copy Code code as follows:

server {
Listen default;
return 500;
}

You can also collect these traffic, import to their own website, as long as the following jump settings can be:
Copy Code code as follows:

server {
Listen default;
Rewrite ^ (. *) http://www.jb51.net permanent;
}

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.