At Shine Servers Hosting all our servers have Google’s mod_pagespeed installed. We have seen good website load time decreases, with server load only increasing noticeably when creating the cache from scratch.
The only irritating thing for developers is that sometimes mod_pagespeed does not recognise that you have updated an image or other files and keeps serving up the old version. This is espically true when making small changes.
Luckily deleting the cache is quite simple. You need root access for this. First SSH to your server. Then type or paste in the following commands;
sudo mv /var/mod_pagespeed/cache /var/mod_pagespeed/cache.del
sudo rm -rf /var/mod_pagespeed/cache.del
sudo mkdir /var/mod_pagespeed/cache
sudo chown nobody:nobody /var/mod_pagespeed/*
The first line moves your cache directory the second deletes the now moved directory. This code assumes that you are using the default cache directory, if you have changed the directory remember to change the code! The third line recreates the cache directory and the fourth sets the correct permissions on the folder.
This will clear all cache on disk there is also cache stored in memory and the only way to remove this is to restart Apache. You should be able to restart Apache from your servers GUI control panel, such as Cpanel.
I will be posting more blog entries about google mod_pagespeed including how to customise it and fix problems it may cause on your website.
No need to remove the cache directory if you have an outdated file. All you have to do is run ‘touch /var/mod_pagespeed/cache/cache.flush’ and wait a few seconds. This will invalidate all the entries in mod_pagespeed’s cache, and it will reload the resources from origin. Even better, if your configuration allows it, set up the ModPagespeedLoadFromFile option. With this, mod_pagespeed will load files directly from the file system, rather than using an HTTP fetch, meaning mod_pagespeed will reloaded resources automatically when they change, rather than waiting for their cache lifetime to expire.
It doesn’t work on cPanel servers i guess ? As it doesn’t worked for us ? I got a error saying file doesn’t exists.