Challenge 2: A Regex Block Beats a Plain Prefix Block Written Earlier — Solution Walkthrough Which block actually handles the request: The regex block, location ~* \.(jpg|png)$ { ... }, handles the request for /images/photo.jpg — not the plain prefix block, location /images/ { ... }, even though that prefix block was written first in the config file. Why file order doesn't decide this: Per this chapter's own precedence section, Nginx checks location types in a fixed algorithmic order, not simply top to bottom through the file. Plain prefix matches are only used as a fallback once every regex location has been checked and none of them matched. Since /images/photo.jpg does match the regex \.(jpg|png)$, that regex block wins regardless of which block appears first in the file — the plain prefix block never even gets a chance to handle this particular request. Where file order actually does matter: If there had been two or more regex blocks that could both match the same request, the order those regex blocks are written in relative to each other would decide which one wins (first match, in file order). That's a completely different comparison from prefix-vs-regex, which is what's actually being tested in this exercise. WHY THIS WORKS AS AN ANSWER ------------------------------ This exercise directly targets the exact misconception this chapter's own warning box calls out — correctly identifying that regex always beats a plain prefix regardless of file order, and that file order only matters when comparing regex blocks against each other.