correct usage of location context?

Avleen Vig avleen at gmail.com
Sat Jun 13 18:46:01 MSD 2009


On Jun 13, 2009, at 5:53, Igor Sysoev <is at rambler-co.ru> wrote:

> On Fri, Jun 12, 2009 at 11:01:57PM +0200, Szymon Polom wrote:
>
>> Igor Sysoev wrote:
>>
>>> On Fri, Jun 12, 2009 at 06:05:34PM +0200, Szymon Polom wrote:
>>> As it was already said by Cliff:
>>
>> [...]
>>
>> As someone on #nginx pointed out I was actually looking for  
>> location +
>> alias not for location + root.
>
> You should not use "alias" there, where "root" is enough. If you use
>
> location /test/ {
>    alias /var/www/test/;
> }
>
> then
>
> location /test/ {
>    root /var/www;
> }
>
> is just the some, but more efficient.

This is almost correct except that the OP forgot one important detail  
which I got from him on IRC last night. 'test' is not a directory on  
his filesystem.

Thus, requests for /var/www/test would fail with 'No such file or  
directory'.

This is why think he needs an alias :)





More information about the nginx mailing list