Powered by Apache

Easy Clear mod_pagespeed Cache

Quick and easy way to clear the cache for mod_pagespeed without having to wipe out the cache folder manually.


If you find the mod_pagespeed module caching needs to have a manual clearing as I did- I made a CSS change and found I could not fetch a new copy- even though the file on the server was indeed changed- all you need to do is touch the file cache.flush in the cache directory, restart Apache, and in a couple minutes, the cache should clear.

To do this log in to the server and do the following:

1. Determine your cache location in pagespeed.conf (your location may vary from this)

sudo grep -i "filecachepath" /etc/apache2/mods-enabled/pagespeed.conf
# The ModPagespeedFileCachePath directory must exist and be writable
ModPagespeedFileCachePath "/var/cache/mod_pagespeed/"

2. Touch the cache.flush file

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

3. Restart apache

sudo service apache2 restart

In a few minutes your cache should be cleared and you should see your new version of your CSS or whatever file you were trying to verify. Naturally if you're doing more than a few changes, you may want to turn off mod-pagespeed- buit for a simple change, this should do it.


Comments (0)


Add a Comment

This thread has been closed from taking new comments.