A
A
AlexRas2017-02-03 16:23:15
Google
AlexRas, 2017-02-03 16:23:15

How to set up pagespeed mod on ngnix to work stably?

Hello.
I will check through https://developers.google.com/speed/pagespeed/insights/
When checking, there are always different readings, then it says turn on the browser cache, then optimize the pictures. Sometimes everything looks good.
The config says:

pagespeed on;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
    add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Kazak, 2019-01-27
@Vetall0779

You need to increase the cache lifetime.
Add the following:
pagespeed on;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
location ~ "\.pagespeed\.([az]\.)?[az]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
This will increase the cache lifetime to one day, increase the cache size to 400mb.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question