Caching and speeding up a site on cPanel hosting
There is no separate server page cache (Nginx cache) on cPanel hosting, so there is nothing to clear there. If the site shows an old version after a change, it is almost always the cache of a CMS plugin, Cloudflare or the browser.
If you see an old version of a page
- clear the plugin cache (WP Super Cache, W3 Total Cache, LiteSpeed Cache, WP Rocket) in the site admin;
- if the site uses Cloudflare - "Caching" -> "Purge Everything";
- open the page in a private window or press Ctrl+F5.
How to speed up the site
- Turn on compression: "Optimize Website" (group "Software") -> "Compress All Content" -> "Update Settings".
- Install a page caching plugin if you use WordPress.
- Choose a recent PHP version: PHP version. PHP 8.x is noticeably faster than 7.x.
- Compress images (WebP) and remove unused plugins.
Browser cache for static files
Add to .htaccess in the site folder:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/webp "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
</IfModule>