try_files for cache

Marcos Neves marcos.neves at
Fri Dec 4 16:27:38 MSK 2009

I am using this config to try the url, if not found, try the same url under
/_cache/ if not, use the router at index.php

    location / {
      try_files $uri /_cache$uri /index.php;

I dont try the above for those kind of files, so I want to get a 404 when
they are not founded.

    location ~* \.(css|js|jpg|png|gif|swf|html?|txt|sql|doc|pdf|xls)$ {

   - Is there a better way to do the same?
   - how can I put the _cache folder outside webroot? Is it possible to
   serve files outside root folder?
   - this configuration will break my passenger routes?

Marcos Neves
+55 44 9918-8488
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list