Nginx 访问控制

根据 IP 限制访问:

location /admin/ {
    allow 192.168.1.1;
    allow 192.168.1.2;
    deny all;
}

根据正则限制访问:

location ~.*(abc|image)/.*\.php$ {
    deny all;
}

根据 user_agent 限制访问:

if ($http_user_agent ~ 'Spider/3.0|YoudaoBot|tomato') {
    deny all;
}

 

 

 

 

 

 

 

    

posted @ 2019-01-29 14:48  孔雀东南飞  阅读(93)  评论(0编辑  收藏  举报