try_files and expires

rainer at ultra-secure.de rainer at ultra-secure.de
Tue Dec 8 14:34:28 UTC 2015


Hi,

I have a case with a CMS (pimcore) and setting the expires directive.

     location / {
         # First attempt to serve request as file, then as directory, 
then fall back to index.php
         try_files $uri $uri/ /website/var/assets/$uri /index.php?$args;
         index index.php;
     }

So, there are "assets" (pdfs, mostly but also some images) in a 
subdirectory.

This works, but this directive:

     location ~* 
\.(jpe?g|gif|png|bmp|ico|css|js|pdf|zip|htm|html|docx?|xlsx?|pptx?|txt|wav|swf|avi|mp\d)$ 
{
         access_log off;
         log_not_found off;

         expires 1w;
     }

breaks the first directive.

Is there a way to have both?



Rainer



More information about the nginx mailing list