Rewrite help when files do NOT have a ".php" extension

António P. P. Almeida appa at
Wed Jun 1 17:31:05 MSD 2011

On 1 Jun 2011 14h23 WEST, nginx-forum at wrote:

> Thanks so much appa. In your suggested example, is there an opening
> bracket after "location
> /site/.*\.(?:xml|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|doc|xls|exe|ppt)$"
> ?

Yes there *should* be one {. I forgot that. 

location /site/.*\.(?:xml|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|doc|xls|exe|ppt)$ {
> I got confused a bit with the blocks structure there. 

It looks confusing but in fact is clearer since you're reducing your
exposure to potential config bugs due to unwanted side effects of
regex based locations.

> Will try some of this, and get back with results here especially
> related to the last "try_files" bit. I didn't fully comprehend what
> you are suggesting, but let me read it some more times and try
> stuff.

--- appa

More information about the nginx mailing list