Specific calculators, planners, and explainers for jobs that usually get buried in forums.
HTML-first, no account wall
Shareable URLs and direct outputs
Sysadmin · Explorer · Interactive explainer
Nginx location match explorer
Paste a set of location blocks, try a request path, and see which block Nginx would choose,
including exact-match checks, longest-prefix memory, regex order, and the ^~ short-circuit.
Why this page is useful
- It shows the actual decision path instead of only restating the precedence rules.
- It makes regex order visible, which is where many real config surprises come from.
- It keeps the strongest literal prefix in memory so you can see when regex overrides it.
- It models the common top-level
locationselection flow without making you mentally simulate Nginx.
Winning location
Decision trace
Candidate scan
Matching order refresher
- Exact
=matches win immediately. - Nginx remembers the longest matching literal prefix.
- If that remembered prefix uses
^~, regex checks are skipped. - Otherwise regex locations run in declaration order, and the first regex match wins.
- If no regex matches, Nginx falls back to the remembered literal prefix.
Common debugging traps
- A shorter regex can beat a longer plain prefix unless the prefix uses
^~. - Regex order matters. The first matching regex wins, not the most specific regex.
- Query strings are ignored here because Nginx location matching works on the URI path.
- If you paste an invalid regex, the tool flags it instead of pretending it matched.