Apache forbids specifying user_agent (prevents crawlers from scratching)
This function can prohibit some of the access lists we don't need (), which can be achieved by rewriting the rewrite module.
Tail / tmp/
Tail / usr/local/apache2/logs/test.com-access_20150121_log
Add the following information to the rewrite module:
RewriteCond% {HTTP_USER_AGENT} ^. * curl.* [NC,OR]
RewriteCond% {HTTP_USER_AGENT} ^. * chrome* [NC]
RewriteRule. *-[F]
Save exit
test
Apachectl-t
Apachectl restart
Curl-x127.0.0.1 80 www.test.com/data/forum.php (default 403 error)
Curl-x192.168.11.160curl 80 www.test.com/data/forum.php (default 403 error)
Vi / usr/local/apache2/conf/extra/httpd-vhosts.conf (commented out)
# RewriteCond% {HTTP_USER_AGENT} ^. * curl.* [NC,OR]
Apachectl-t
Apachectl restart
Curl-x 192.168.11.160 curl 80 www.test.com/adsjkf
Curl-x 192.168.11.160 www.test.com/forum.php 80 www.test.com/forum.php-I)
Browser www.test.com
Curl-A "sdfsadsdfa"-x192.168.11.160 www.test.com/forum.php 80 www.test.com/forum.php-I
Curl-A "sdfsadchrome sdfa"-x192.168.11.160 www.test.com/forum.php 80 www.test.com/forum.php-I