Question

how to fix Leverage browser caching nginx?

i went to the Internet, put all the possible settings for caching, but all the same the end of google page sped insights wrote that I do not have caching for these files how to fix this?

this question have on StackOverflow https://stackoverflow.com/questions/47966400/how-to-fix-leverage-browser-caching-nginx

my cache settings “nano /etc/nginx/nginx.conf”

proxy_temp_path /var/nginx/proxy_temp;
add_header X-Cache-Status $upstream_cache_status;
proxy_cache_path /tmp/nginx/cache levels=1:2 keys_zone=one:100m;
proxy_cache one;
proxy_cache_valid any 30d;
proxy_cache_key $scheme$proxy_host$request_uri$cookie_US;

my server conf “nano /etc/nginx/sites-enabled/theband”


location ~* ^(?!/media).*.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
    expires 365d;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    access_log off;
}
location ~* ^(?!/static).*.(?:css|js|html)$ {
    expires 365d;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    access_log off;
}

location / {
    proxy_set_header X-Real-IP $remote_addr;

    proxy_cache one;
    proxy_cache_min_uses 1;
    proxy_cache_use_stale error timeout;

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You can also slove your Leverage Browser Caching problem with W3 Total Cache Plugin Link: https://www.2019cricketworldcup.co/ I used this plugin on my client Cricket related site and the performance scores is 95 out of 100. Here is the link you can check https://www.2019cricketworldcup.co/

Website Link Example Link

Leverage Browser Caching you should use the plugin: Leverage Browser Caching link down: https://wordpress.org/plugins/leverage-browser-caching/

I used for website: http://www.thuocmaxman.vn/ and get 99/100 points. only … / google analytics.js (2 hours)

Example link

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.