Help with location tag / reg ex

I’d like to match all of the media files in this sub directory (and
subsequent directories) but its not working.

location ~* /_games/\.(jpg|jpeg|png|gif|swf|flv|mp3)$ {
  expires max;
}

My regular expression is off the mark…

Thanks

On Thursday 29 December 2011 22:51:13 Ilan B. wrote:

I’d like to match all of the media files in this sub directory (and
subsequent directories) but its not working.

location ~* /_games/\.(jpg|jpeg|png|gif|swf|flv|mp3)$ {
  expires max;
}

My regular expression is off the mark…

Your regexp matches URIs only like these:
/_games/.gif
/_games/.flv
etc…

Probably, you want:

location ~* /_games/.+.(?:jpe?g|png|gif|swf|flv|mp3)$ {
expires max;
}

or, maybe:

location /_games/ {
location ~* .(?:jpe?g|png|gif|swf|flv|mp3)$ {
expires max;
}
}

Please, read:
man pcrepattern
man pcresyntax

wbr, Valentin V. Bartenev

Thank you for your response, I was able to resolve, really appreciate
it.
My solution was along the same lines as yours.

On Thu, Dec 29, 2011 at 2:22 PM, Valentin V. Bartenev [email protected]
wrote:

man pcresyntax

wbr, Valentin V. Bartenev


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Ilan B.
Chief Technology Officer
Time4Learning.com

6300 NE 1st Ave., Suite 203
Ft. Lauderdale, FL 33334
(954) 771-0914

http://www.twitter.com/time4learning
http://www.facebook.com/Time4Learning

Time4Learning.com - Online interactive curriculum for home use, PreK-8th
Grade.
Time4Writing.com - Online writing tutorials for high, middle, and
elementary school students.
Time4Learning.net - A forum to chat with parents online about kids,
education, parenting and more.
spellingcity.com - Online vocabulary and spelling activities for
teachers,
parents and students.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs