Welcome! Log In Create A New Profile

Advanced

Re: Alias not working on 0.7.35

April 03, 2009 12:42AM
On Fri, Apr 03, 2009 at 09:51:39AM +0700, Glen Lumanau wrote:

> Here's my configuration
>
> root /home/myhome;
>
> access_log /var/log/nginx/access.log;
>
> location ~ \.flv$ {
> flv;
> }
>
> location /default {
> alias /home/yourhome/content;
> }
>
> location ~ ^/default/(.+\.flv)$ {
> alias /home/yourhome/content/$1;
> flv;
> }
>
> When I tried to access /default/filename.flv, it still redirect me to
> /home/myhome/default/filename.flv. And it shows file not found

You need to change order of regex locations:

location ~ ^/default/(.+\.flv)$ {
alias /home/yourhome/content/$1;
flv;
}

location ~ \.flv$ {
flv;
}

Otherwise, "\.flv$" is matched first.

> # nginx -v
> nginx version: nginx/0.7.46
>
> -----Original Message-----
> From: owner-nginx@sysoev.ru [mailto:owner-nginx@sysoev.ru] On Behalf Of Igor
> Sysoev
> Sent: 01 April 2009 12:04
> To: nginx@sysoev.ru
> Subject: Re: Alias not working on 0.7.35
>
> On Wed, Apr 01, 2009 at 09:59:39AM +0700, Glen Lumanau wrote:
>
> > 2009/3/31 Igor Sysoev <is@rambler-co.ru>
> >
> > > On Tue, Mar 31, 2009 at 01:56:01PM +0700, Glen Lumanau wrote:
> > >
> > > > I tried to put this configuration on my nginx.conf
> > > >
> > > > location /default/ {
> > > > alias /home/myhome/content/;
> > > > }
> > > >
> > > > location ~ \.flv$ {
> > > > flv;
> > > > }
> > > >
> > > > But it doesn't work.
> > > >
> > > > When opening a FLV files, it always pointed me to the root directory
> > > which
> > > > is /home/myhome
> > > >
> > > > Is there anythink i've missed?
> > >
> > > You need the last 0.7.x:
> > >
> > > location /default/ {
> > > alias /home/myhome/content/;
> > > }
> > >
> > > location ~ ^/default/(.+\.flv)$ {
> > > alias /home/myhome/content/$1;
> > > flv;
> > > }
> >
> > Why do we need to put an alias on the flv?
>
> Because "/default/some.flv" will choose "\.flv$" location, but not
> "/default/" one.
>
> > Is this method not work on 0.6.35 ?
>
> No, currently 0.6.x does support captures in location, and I'm not sure
> if I will merged it from 0.7: there are many changes in location processing
> in 0.7.
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>

--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

Alias not working on 0.7.35

Glen Lumanau March 31, 2009 02:56AM

Re: Alias not working on 0.7.35

Igor Sysoev March 31, 2009 03:05AM

Re: Alias not working on 0.7.35

Glen Lumanau March 31, 2009 10:59PM

Re: Alias not working on 0.7.35

Igor Sysoev April 01, 2009 01:04AM

RE: Alias not working on 0.7.35

Glen Lumanau April 02, 2009 10:51PM

Re: Alias not working on 0.7.35

Igor Sysoev April 03, 2009 12:42AM

RE: Alias not working on 0.7.35

Glen Lumanau April 03, 2009 01:53AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 332
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready