correct usage of location context?

Cliff Wells cliff at
Fri Jun 12 23:15:11 MSD 2009

On Fri, 2009-06-12 at 13:57 -0500, Nick Pearson wrote:
> If you want to map a request to /test/x to /var/www/test/x instead
> of /var/www/test/test/x, it sounds like you need a rewrite to remove
> "/test" from the request URI.  

A rewrite adds needless processing to every request.

location /test/x {
    root /var/www;

is much simpler and more efficient.   All requests that map through this
location will serve files from /var/www/test/x. 



More information about the nginx mailing list