nginx location blocks
Nginx has tons of options for handling uri requests inside a location block.
To match an exact route, use the = sign.
location = /exact-match.html {
# do stuff here
}To match a route prefix, just drop the =
location = /users {
# do stuff here
}This will match any request that starts with /users, i.e. /users/summary
You can also do regex-style pattern matching, helpful for serving up static assets:
location ~* \.(css|scss|less|)$ {
# do stuff here
}The ~* matches regardless of case, i.e. STYLES.CSS or styles.css. To do exact matching (case sensitive), just drop the *.