Nginx as a reverse caching / load balancing solution - verification of setup needed.

Sebastian Krebs krebs.seb at
Fri Sep 4 11:29:56 UTC 2015

2015-09-04 12:04 GMT+02:00 Brent Clark <brentgclarklist at>:

> Good day Guys.
> I would like to ask if someone could please verify my configs :
> I have a Nginx server sitting in front of two Apache servers.
> I'm using Nginx as a reverse caching / load balancing solution.
> But what I'm trying achieve is to cache only for images, css and Js.
> All in all it appears it all works.
> The other question I would like to ask is, does the order of location
> matter?

Depends. For regular expression based location is does, for prefix based
locations it doesn't. See

A location can either be defined by a prefix string, or by a regular
> expression. Regular expressions are specified with the preceding “~*”
> modifier (for case-insensitive matching), or the “~” modifier (for
> case-sensitive matching). *To find location matching a given request,
> nginx first checks locations defined using the prefix strings (prefix
> locations). Among them, the location with the longest matching prefix is
> selected and remembered. Then regular expressions are checked, in the order
> of their appearance in the configuration file. The search of regular
> expressions terminates on the first match, and the corresponding
> configuration is used. If no match with a regular expression is found then
> the configuration of the prefix location remembered earlier is used.*

> If anyone can help, it would be appreciated.
> Thanks
> Brent
> _______________________________________________
> nginx mailing list
> nginx at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list