Nginx location and rewrite configuration made easy

(via blog.rackcorp.com)

The best way to think of things is that as a request comes in, Nginx will scan through the configuration to find a “location” line that matches the request. There are TWO modes that nginx uses to scan through the configuration file: literal string matching and regular expression checks. Nginx first scans through ALL literal string location entries in the order that they occur in the configuration file, and secondly scans through ALL the regular expression location entries in the order that they occur in the configuration file. So be aware – location ordering order DOES matter...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

nginx location directive

Comment