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