Forum: NGINX location issue

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Glen L. (Guest)
on 2009-01-29 08:08
(Received via mailing list)
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
Glen L. (Guest)
on 2009-01-30 02:22
(Received via mailing list)
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
Igor S. (Guest)
on 2009-01-30 02:22
(Received via mailing list)
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;
     }
Sergey B. (Guest)
on 2009-01-30 02:22
(Received via mailing list)
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 L. <removed_email_address@domain.invalid> [2009-01-29 13:02:24 +0700]:

>
> /home/test/images/stories/a.jpg
>
>
>
>
>
Сергей Боченков, СПОРРТ
Бегун
Glen L. (Guest)
on 2009-01-30 02:22
(Received via mailing list)
Thank's..

Sorry I missed that part
This topic is locked and can not be replied to.