禁止指定user_agent

listen 80;

    server_name www.test1.com www.aaa1.com www.bbb1.com;

    if ($host != 'www.test1.com')

      {

   rewrite ^/(.*)$ http://www.test1.com/$1 permanent;

     }

    index index.html index.htm index.php;

    root /data/www;

     access_log /tmp/access.log 123123

    deny 1.1.1.1

deny ip

  

* if ($http_user_agent ~ 'bingbot/2.0|MJ12bot/v1.4.2|Spider/3.0|YoudaoBot|Tomato|Gecko/20100315')

{

return 403; 

 }

    location ~ .*admin\.php$ {

       auth_basic "123123 auth";

      auth_basic_user_file /usr/local/nginx/conf/.htpasswd;

 include fastcgi_params;


你可能感兴趣的:(user,agent,禁止指定)