温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如果根据日志去禁用user_agent

发布时间:2020-03-24 17:53:12 来源:网络 阅读:571 作者:lizheng103 栏目:网络安全

查看user_agent


打开日志文件 cat /usr/local/apache2/logs/test.com-access_20161111_log


如果根据日志去禁用user_agent

如果根据日志去禁用user_agent

如何不显示chrome和curl的日志


1.打开虚拟主机配置文件


vi /usr/local/apache2/conf/extra/httpd-vhosts.conf


添加一代代码



<IfModule mod_rewrite.c>

        RewriteEngine on

        RewriteCond %{HTTP_HOST} ^www.test.com$ [OR]

        RewriteCond %{HTTP_HOST} ^www.aaa.com$ ----添加一行

        RewriteRule ^/(.*)$ http://ww.lizheng.com/$1 [R=301,L](以/开始,$1作为标记)

条件一Rewritecond %{HTTP_USER_AGENT} ^.*curl.* [NC,OR]    添加的代码,关于curl

条件二Rewritecond %{HTTP_USER_AGENT} ^.*chrome* [NC]  添加的代码,关于chrome

  结果RewriteRule     .*  -  [F]                                                禁止

</IfModule>


如果根据日志去禁用user_agent

如果根据日志去禁用user_agent

2.重新启动,加载


apachectl -t


apachectl graceful



3.测试


curl -x127.0.0.1:80 www.lizheng.com/asasddas


如果根据日志去禁用user_agent 如果根据日志去禁用user_agent




如果根据日志去禁用user_agent


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI