Day 20th: The basic configuration of Apache under Architecture (ii)

Source: Internet
Author: User

Small Q: When others delete you, the system will not tell you, is afraid of you sad, when you delete others, the system will

Remind you, is afraid you regret, the system is so, people that ....



Today, finish yesterday's unfinished task, Apache configuration; But in the dormitory, the efficiency feeling has declined, although the quiet has the atmosphere of learning, but I really do not think so, at least for me, not. The mood is not good, so always stay.


Apache prohibits the specified user_agent:


When we set the partition log format, we used the combine format, all kinds of end is user_agent, representing the network logo or search engine kernel?

Sometimes when our website is very large, at least half of the spider-like spiders are caused by some search engines (such as 360. Youdao. Some foreign websites, etc.), crawlers can browse your website like a human.

This will cause a lot of load on our website, so we have to ban them.


Enter the virtual host profile:

Vim/ysr/local/apache2/conf/extrs/httpd-vhosts.conf

Add the rewrite module, and we set the domain name jump has been done, so directly add in the good


Rewritecond%{http_user_agant} ^.*chrome* [Nc,or] NC case insensitive

Rewritecond%{http_user_agant} ^.*wo.* [NC]

Rewriterule. *-[F] prohibit chrom mark

Save Detection Reload

Testing: Web site testing, or curl testing

Curl-a "Asdchromds"-x127.0.0.1:80 www.test.com

Curl-a "Asdcmds"-x127.0.0.1:80 Www.test.com-I





To restrict a directory through the rewrite module:


In some cases, we have some important files in the website directory, do not want to let people see, we need to encrypt; before we learned to restrict IP users to visit, this time we use another way to encrypt the directory.


Enter the virtual host profile:

Under the Rewrite module, add:

Rewritecond%{request_uri} ^.*/tmp/.* [NC]

Rewriterule. *-[F]












Day 20th: The basic configuration of Apache under Architecture (ii)

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.