12

We have a server (OVH - France), with Apache and mod_pagespeed. On this server, I have an installation of WordPress.

I made a change in a Javascript file in my theme, but pagespeed don't understand there is a new file, and keeps loading the original javascript file. js/ui.js.pagespeed********

I made the change two weeks ago, rebooted the server this morning, and it is still loading the original Javascript file.

How can I delete the pagespeed cache?

On my server, in /var/mod_pagespeedcache/http,3A/,2Fwww.myURL.fr/wp-content/themes/mytheme/js, I see the ui.js.pagespeed.jm.************.js.

Could I just delete this file?

2

6 Answers 6

15

Google's PageSpeed docs on Legacy Flushing Of Entire Cache suggests this:

sudo touch /var/cache/mod_pagespeed/cache.flush
4
  • 4
    Just a heads up - I have tried this multiple times to no avail. I have also seen other responses saying that it didn't work.
    – mcheah
    Jun 6, 2017 at 17:23
  • works for me. maybe due to which OS and pagespeed version. mine is Debian 7.10 with X-Mod-Pagespeed "1.9.32.14-0" Jul 14, 2017 at 20:14
  • If doesn't work, try ctrl+f5 in browser to reload page with cache clear.
    – userlond
    Feb 20, 2019 at 1:57
  • This worked for me on Debian 10, Apache/2.4.38, mod-pagespeed-stable 1.13.35.2-r0
    – antisa
    Aug 17, 2021 at 7:42
7

From: https://developers.google.com/speed/docs/mod_pagespeed/faq#ignores-changes

There are two distinct cache-times at play when you use mod_pagespeed:

The origin TTL which mod_pagespeed uses to refresh its internal server-side cache.

The TTL with which mod_pagespeed serves rewritten resources to browsers. When mod_pagespeed first reads your reousrce file, it uses the origin TTL to figure out how often to re-examine the origin CSS file. Assume your origin TTL is 1 day. Once mod_pagespeed has that file in cache, it will not go back & re-check that file for a day. Changing the TTL after mod_pagespeed has put the resource in its cache will not help because mod_pagespeed is not going to reload the resource until the one in its cache expires, or you clear its cache.

We recommend an origin TTL of 10 minutes, which provides reasonable responsiveness when you update a file. If you try to make it much smaller, then your server will need to refresh it more frequently. This adds server load and reduces optimization.

To see changes to your files more quickly while developing, flush the cache on your server(s).

If your environment allows you to enable ModPagespeedLoadFromFile, you can get the best of both worlds because mod_pagespeed can eliminate its internal server-side cache.

4

Flushing the cache of a specific page in Pagespeed requires that the server support cache purging. In Apache, this means ModPagespeedEnableCachePurge on in the site's configuration. In Nginx, you'll need pagespeed EnableCachePurge on; instead. This setting allows you to send a specially-crafted HTTP request to force-purge a specific page in Pagespeed. For example with cURL:

curl 'http://example.com/pagespeed_admin/cache?purge=path/file.ext'

There is also another method for purging single pages in the cache (curl --request PURGE 'http://www.example.com/path/file.ext'), however this requires an extra, optional config option in your site's config file (ModPagespeedPurgeMethod PURGE for Apache and pagespeed PurgeMethod PURGE; for Nginx).

For more information, please refer to the documentation describing this process for more detail.

3
sudo touch /var/cache/mod_pagespeed/cache.flush

Load the page again. You should see the changes

3

On bitnami AWS server (lightsail) use this commands:

sudo touch /opt/bitnami/apache2/var/cache/mod_pagespeed/cache.flush

Restart Apache:

sudo /opt/bitnami/ctlscript.sh restart apache

Here is the help page.

0

Flush cache nginx pagespeed

sudo touch /var/cache/ngx_pagespeed/cache.flush

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.