Location filter

Hi everybody,

i’m a newbie with nginx, i use nginx for static content and apache.

i use actually :
location ~*
^.+.(jpg|jpeg|gif|png|bmp|ico|pdf|flv|swf|exe|txt|css|js|xml|woff|eot|ttf|svg)$
{
and all is ok

but i want to remove from nginx a dynamic image, ex : logo_125_21.gif
who is
generated by apache/php (with rewrite)
numbers are randoms.

so how can i modify the location line for exclude logo__.gif please ?
all
my tests failed.

Thanks

Posted at Nginx Forum:

On Fri, Oct 03, 2014 at 04:32:06AM -0400, rapamiti wrote:

Hi there,

i use actually :
location ~*
^.+.(jpg|jpeg|gif|png|bmp|ico|pdf|flv|swf|exe|txt|css|js|xml|woff|eot|ttf|svg)$
{
and all is ok

but i want to remove from nginx a dynamic image, ex : logo_125_21.gif who is
generated by apache/php (with rewrite)
numbers are randoms.

If I’ve understood you correctly:

See Module ngx_http_core_module and possibly
How nginx processes a request

and add a separate location that does match your urls – something like
~logo.*gif$ – that will apply before your current location.

f

Francis D. [email protected]

hi, thanks you right,

so i must add a location like this :
location ~logo_(\d+)_(\d+).gif$ {

My regex is correct ? (ex: logo_5435_252.gif logo_25_1.gif etc…)

Posted at Nginx Forum:

On Fri, Oct 03, 2014 at 06:02:59AM -0400, rapamiti wrote:

Hi there,

so i must add a location like this :
location ~logo_(\d+)_(\d+).gif$ {

My regex is correct ? (ex: logo_5435_252.gif logo_25_1.gif etc…)

That looks right to me – it will match the examples you give; it will
also match some others like logo_5435_252gif or logo_25_1Xgif; and it
will not match logo_5435_252.GIF

f

Francis D. [email protected]