Nginx is set to prohibit access to the server through ip addresses and can only be accessed through domain names

Source: Internet
Author: User
: This article mainly introduces how to disable access to the server through ip addresses on nginx. you can only access the server through the domain name. if you are interested in the PHP Tutorial, refer to it.
To prevent unauthorized domain names from being resolved to their own server ip addresses, the server may be disconnected from the network. in nginx, you must disable access to the server through ip addresses and only access through domain names. The most important thing is to add such a line in the server settings: Listen 80 default; the default parameter next to it indicates that this is the default VM. For example, if you want to disable the display of any valid content when someone accesses your website through an ip address or an unknown domain name, you can return 500 to someone else. The details are as follows: Server {Listen 80 default; Server_name _; Return 500;} of course, according to the above settings, it is indeed impossible for others to access the Server through an ip address, however, one or more real domain names to be accessed should also be opened, and the configuration should be set as follows: Server {Linten 80; Server_name www.941db.com; (take the world Sea for example) ...........}

The above describes how to disable access to the server through ip addresses on nginx, and only access through domain names, including some content. I hope to be helpful to anyone interested in PHP tutorials.

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.