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;
}

    

猜你喜欢

转载自www.cnblogs.com/pzk7788/p/10334071.html