1

I'm currently trying to cache css and js files with the widely known config as follows:

location ~* \.(png|jpg|css|js|jpeg|gif|ico|xls|doc|zip|exe|mp3|mp4|pdf|ai|psd|eps|ppt|dmg|csv|key|numbers|cur|gz|pages)$ {
        expires 7d;
    }

I have also tried the following config from https://github.com/nystudio107/nginx-craft/blob/master/nginx-partials/expires.conf

location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";

However with both of these configs I get 404 (not found) when trying to load css and js everything else works fine jpeg, png, ...etc.

When I remove js and css from the config it works perfectly, however its not being cached.

Any thoughts are much appreciated!

-Adam

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.