Welcome! Log In Create A New Profile

Advanced

Re: Simple arithmetics in nginx config

November 29, 2011 03:35AM
agentzh Wrote:
-------------------------------------------------------
> On Mon, Nov 28, 2011 at 4:11 PM, mennanov
> <nginx-forum@nginx.us> wrote:
> >
> > location ~ /i/(.*)\.jpg {
> >            set $folder $1-($1%100);
> >            try_files /i/$folder/$1.jpg
> =400;
> >        }
> >
> > but of course it does not work due to syntax
> error.
> >
>
> The standard "set" directive does not support
> arithmetic operations at
> all. But it's an ideal use case for our ngx_lua
> module:
>
> location ~ /i/(.*)\.jpg {
> set_by_lua $folder 'return ngx.var[1] -
> (ngx.var[1] % 100)';
> try_files /i/$folder/$1.jpg =400;
> }
>
> See http://wiki.nginx.org/HttpLuaModule for
> details.
>
> Regards,
> -agentzh
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Thank you so much, i've just recompiled nginx with this module and it just works!
Subject Author Posted

Simple arithmetics in nginx config

mennanov November 28, 2011 03:11AM

Re: Simple arithmetics in nginx config

agentzh November 28, 2011 03:34AM

Re: Simple arithmetics in nginx config

mennanov November 29, 2011 03:35AM

Re: Simple arithmetics in nginx config

arut December 05, 2011 05:27AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 165
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