hey,
I’m using this for myself, but only for static files:
location ~* \.(css|js)$ {
expires 7d;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
add_header "Vary" "Accept-Encoding";
}
location ~* \.(png|ico|gif|svg|jpg|jpeg|webp)$ {
expires 14d;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
add_header "Vary" "Accept-Encoding";
}
location ~* \.(avi|mpg|mpeg|mp4|mp3)$ {
expires 14d;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
add_header "Vary" "Accept-Encoding";
}
I do not add these headers to the regular pages but I guess you could if you want to.
that works great, thank you!
any suggestions for gzip settings below? cannot figure out why pagespeed still tells me that i need to enable compression – wondering if my ‘gzip types’ line is wrong …
gzip on;
gzip_disable “msie6”;
gzip_comp_level 6;
#gzip_comp_level 9;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
# gzip_http_version 1.1;
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;
My settings:
##
# Gzip
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_min_length 100;
gzip_http_version 1.1;
gzip_comp_level 1;
gzip_proxied any;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/xml+rss application/json image/svg+xml;
# gzip_proxied any;
gzip_buffers 128 16k;
I belive they are more or less the same, your settings should be working as well.
My settings:
##
# Gzip
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_min_length 100;
gzip_http_version 1.1;
gzip_comp_level 1;
gzip_proxied any;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/xml+rss application/json image/svg+xml;
# gzip_proxied any;
gzip_buffers 128 16k;
I belive they are more or less the same, your settings should be working as well.
thank you!!! my gzip works now with your settings