Welcome! Log In Create A New Profile

Advanced

Re: "alias" directive may not be used inside location given

July 07, 2010 08:42AM
On Wed, Jul 07, 2010 at 02:32:57PM +0200, Fernando Perez wrote:

> I don't understand the following error:
>
> the "alias" directive may not be used inside location given by regular
> expression
>
> >From the docs it seems possible:
> http://wiki.nginx.org/NginxHttpCoreModule#alias
>
> I'm running 0.7.38

This is possible since 0.7.40.

> Here is my conflictual declaration:
>
> location ~* ^/uploads/([\w\-\/]+\.(jpg|m4v|mp4|ogv|png)) {
> alias $rails_path/uploads/production/$1;
> }
>
> I want to map the request /uploads/assets/myfile.png to
> /uploads/production/assets/myfile.png on disk

In this case you do not need regex:

location /uploads/ {
alias $rails_path/uploads/production/;
}

BTW, it's better to not use "set $rails_path /rails;",
but set it in alias:

location /uploads/ {
alias /rails/uploads/production/;
}


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

"alias" directive may not be used inside location given

Fernando Perez July 07, 2010 08:38AM

Re: "alias" directive may not be used inside location given

Igor Sysoev July 07, 2010 08:42AM

Re: "alias" directive may not be used inside location given

Fernando Perez July 07, 2010 09:58AM

Re: "alias" directive may not be used inside location given

Fernando Perez July 07, 2010 10:34AM

Re: "alias" directive may not be used inside location given

Denis F. Latypoff July 07, 2010 08:44AM

Re: "alias" directive may not be used inside location given

Fernando Perez July 07, 2010 09:04AM

Re: "alias" directive may not be used inside location given

Maxim Dounin July 07, 2010 11:44AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 159
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready