Nginxdisables robot robots.txt.

Source: Internet
Author: User

Related to the robots.txt file: the search engine automatically accesses webpages on the Internet and obtains webpage information through a program robot (also called Spider. You can create a pure robot file robots.txt on your website, which declares that the website does not want to be accessed by the robot. In this way, some or all of the content of the website will not be indexed by the search engine, or the specified search engine only contains the specified content.

When you access xxx/robots.txt, you can find that/admin and/BBS exist on our website./adminis the directory of the backend management. It is not safe to expose this simple file. In this case, you can disable the TXT file to increase the website security.


Modify the nginx. conf file, VIM/usr/local/nginx/CONF/nginx. conf

 
  1. Location ~ * \. (Txt | DOC) $ {
  2. Root/usr/local/nginx/html;
  3. Deny all;
  4. }

Specifies the configuration information of the 403.html file.

 
  1. Error_page 403/403 .html;
  2. Location =/403.html {
  3. Root HTML;
  4. }

Reload the configuration file

 
  1. /Usr/local/nginx/sbin/nginx-s reload

When robots.txt is added, the system prompts that the file cannot be accessed.

 

By using this scheme, you can protect the website security on a certain degree, and avoid the possibility of hacking. Using robots.txt, you can guess the directory structure of our website or the actual directories and files.

Of course, you can also disable other designated documents such as. Doc and. XSL. The method is the same.

Nginxdisables robot robots.txt.

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.