Location issue


#1

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


#2

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 L. [mailto:removed_email_address@domain.invalid]
Sent: 29 Januari 2009 12:57
To: ‘removed_email_address@domain.invalid’
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


#3

On Thu, Jan 29, 2009 at 01:02:24PM +0700, Glen L. wrote:

/home/test/images/stories/a.jpg

If someone accessing /thumbnails/a.jpg , will accessing
/home/test/images/thumbnails/a.jpg

Is that case posibble?

 location /images/ {
  •    root            /home/test/images/stories;
    
  •    alias           /home/test/images/stories/;
    

    }

    location /thumbnails/ {

  •    root            /home/test/images/thumbnails;
    
  •    root            /home/test/images;
    
    }

#4

Thank’s…

Sorry I missed that part


#5

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.

/home/test/images/stories/a.jpg

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