I have a problem with nginx/pagespeed module. The images cache-time is default 5 mins on first pageload.
There are in my nginx.conf:
##
# PageSpeed
##
pagespeed on;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
pagespeed Domain https://example.com;
pagespeed Domain *.example.com;
pagespeed MapOriginDomain "http://localhost" "https://example.com";
pagespeed LoadFromFile "https://example.com" "/usr/share/nginx/www/";
pagespeed LoadFromFileRuleMatch Disallow \.php$;
pagespeed XHeaderValue "Powered By ngx_pagespeed";
pagespeed ListOutstandingUrlsOnError on;
pagespeed EnableFilters extend_cache;
# image related
pagespeed EnableFilters rewrite_images;
pagespeed EnableFilters convert_gif_to_png;
pagespeed EnableFilters convert_jpeg_to_progressive;
pagespeed EnableFilters strip_image_color_profile;
pagespeed EnableFilters strip_image_meta_data;
pagespeed EnableFilters jpeg_subsampling;
pagespeed EnableFilters lazyload_images;
# code related
pagespeed EnableFilters collapse_whitespace;
# DNS related
pagespeed EnableFilters insert_dns_prefetch;
# JS related
pagespeed UseExperimentalJsMinifier on;
pagespeed EnableFilters rewrite_javascript;
pagespeed EnableFilters combine_javascript;
# css related
pagespeed EnableFilters rewrite_css;
pagespeed EnableFilters prioritize_critical_css;
pagespeed EnableFilters combine_css;
pagespeed EnableFilters outline_css;
pagespeed EnableFilters flatten_css_imports;
How can I modify the default 5 mins cache-time? How can I pass the images on first pageload via pagespeed module?
It didn't help:
location ~* \.(jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
try_files $uri =404;
}
location ~* \.(pdf|js|css|swf)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
try_files $uri =404;
}
From docs
When PageSpeed fetches a resource via HTTP or HTTPS, it examines the Expires and Cache-Control headers to determine how frequently it should update its cache. When these headers don't specify a timeout, a default timeout of 5 minutes is used. To override this, specify: