Turn off Nginx empty host headers to prevent nginx empty host headers and malicious domain names from pointing _nginx

Source: Internet
Author: User
Tags phpmyadmin

The virtual host in the default configuration of Nginx allows the user to access through IP or through a domain name that is not set (e.g. someone maliciously points his own domain name to your IP)
This is because the server area in the default configuration has this line:
listen default;
The following default parameter indicates that this is the default virtual host, accepting all the domain names that are pointing over.
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.

server {
listen default;
server_name _;
return;
}

You can also collect these traffic, import to your own website, as long as the following jump settings can be:

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

If a multiple-IP server, only one IP is blocked:
You can try this:

server {
listen *:80 default;
server_name _;
return;
}

Try again when you can't:

server {
listen *:80;
server_name _;
return;
}

After using the empty host header, phpMyAdmin will not be able to access, add a level two domain name point to phpMyAdmin directory on the line.

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.