Repository navigation
Howto Use the bundled rules
Goal: start from maintained crawler lists instead of writing every map entry
yourself. The repository's rules/
directory is plain nginx configuration.
git clone --depth 1 https://github.com/teian/ngx_http_pow_gate.git
sudo cp -r ngx_http_pow_gate/rules /etc/nginx/pow-ruleshttp {
include /etc/nginx/pow-rules/verifiers.conf;
map $http_user_agent $pow_decision {
default challenge;
# your own entries go here; they win over the includes below
include /etc/nginx/pow-rules/ai-crawlers.map;
include /etc/nginx/pow-rules/search-engines.map;
# include /etc/nginx/pow-rules/automation.map;
}
}| File | Effect |
|---|---|
verifiers.conf |
defines the search_engines, ai_search and ai_user_fetch verifiers |
search-engines.map |
search-engine User-Agents → verify:search_engines
|
ai-crawlers.map |
AI training crawlers → deny; AI search indexes → verified; the rest → challenge
|
automation.map |
optional: HTTP libraries, headless browsers and empty User-Agents → deny
|
nginx tries the regular expressions of a map in the order they appear, so the
order of the include lines decides which file wins.
Leave automation.map out if the same decision covers an API or a feed that
scripts are meant to fetch. Turn the gate off
for those paths instead.
./scripts/robots2map.py /var/www/robots.txt | sudo tee /etc/nginx/pow-rules/robots.mapEvery User-agent group with Disallow: / becomes a deny entry. Pass
--action challenge:500000 to make those crawlers pay instead. Include the
file like the others.
sudo nginx -t && sudo nginx -s reloadThen watch the gate log: pow=deny reason=policy
lines are the refused crawlers, reason=verified_range and verified_dns are
confirmed good bots, and reason=verifier_unconfirmed is a client that claimed
a crawler's name from the wrong network.
The lists change with module releases. Copy the new files, read the diff, and
run nginx -t. A User-Agent is a claim: these rules stop crawlers that say who
they are. One that pretends to be a browser gets your default decision.
Getting started
Policy
- Let verified search engines through
- Block or slow down crawlers
- Tune difficulty and clearance lifetime
- Exclude paths and APIs
- Use the bundled rules
- Keep link previews working
Deployment
Operations