Nginx settings prohibit IP access to the server, only through the domain name access

Source: Internet
Author: User
In order to avoid other people to the non-filing of the domain name resolution to their server IP and the server is broken network, you need to set the Nginx on the IP access to the server, only through the domain name access. The most critical point is to add this line to the server's settings: Listen default, which means that this is the virtual host. For example, if someone accesses your website through an IP or unknown domain name, you want to suppress any valid content, you can return 500. The following: Server {       Listen default;       server_name _;       Return 500;} Of course, according to the above settings, do not let others through the IP access to the server, but should also open one or more real want to access the configuration of the domain name, set as follows: Server {       linten;       server_name www.941db.com; (Take the Shihai net as an example) ...}

The above describes the Nginx on the set to prohibit through the IP Access server, only through the domain name access, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.