location issue

Sergey Bochenkov bachan at j3qq4.org
Thu Jan 29 09:18:38 MSK 2009


http://wiki.codemongers.com/NginxHttpCoreModule#alias

This directive assigns a path to be used for the indicated location. Note 
that it may look similar to the root directive, but the document root 
doesn't change, just the file system path used for the request. 

For example: 

    location  /i/ {
        alias  /spool/w3/images/;
    }

The request "/i/top.gif" will return the file "/spool/w3/images/top.gif". 
It is possible to use variables in the replacement path. 

The alias directive cannot be used inside a regex-specified location. If you
need to do this you must use a combination of rewrite and root.


* Glen Lumanau <glen at lumanau.web.id> [2009-01-29 13:02:24 +0700]:

> I tried 
> 
>  
> 
>     location /images/ {
> 
>         root            /home/test/images/stories;
> 
>     }
> 
>  
> 
>     location /thumbnails/ {
> 
>         root            /home/test/images/thumbnails;
> 
>     }
> 
>  
> 
> What I want if someone accessing /images/a.jpg , will accessing
> /home/test/images/stories/a.jpg
> 
> If someone accessing /thumbnails/a.jpg , will accessing
> /home/test/images/thumbnails/a.jpg
> 
>  
> 
> Is that case posibble?
> 
>  
> 
>  
> 
> From: Glen Lumanau [mailto:glen at lumanau.web.id] 
> Sent: 29 Januari 2009 12:57
> To: 'nginx at sysoev.ru'
> Subject: location issue
> 
>  
> 
> Hi,
> 
>  
> 
> Is that posibble to have different root directory inside "location"?
> 
>  
> 
> For example :
> 
>     location ^~ /images {
> 
>         root            /home/test/images/stories;
> 
>     }
> 
>  
> 
>     location ^~ /thumbnails {
> 
>         root            /home/test/images/thumbnails;
> 
>     }
> 
>  
> 
>  
> 
> Or where's the error? I've tried with no luck
> 
>  
> 
>  
> 
>  
> 

Сергей Боченков, СПОРРТ
Бегун






More information about the nginx mailing list