fbpx

Server Setup

How to optimize the wp-rocket WordPress plugin

by ,


We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

Best FPC plugin for WordPress?

The best full-page cache plugin for WordPress is actually none and using Varnish instead. Because the best FPC solution for WordPress is Varnish.
Varnish Cache is very flexible, you can tell it to use the fastest cache storage, which is RAM. And this is the default.
You can also tell it to use slower cache storage, which is the disk.

But what if you’re just getting started with optimizing your website? Most likely you then rely on a WordPress plugin to generate your full page cache.

The WP Rocket plugin is best in terms of its simplicity of configuration.

Better cache lives in RAM

But most of the time, the WordPress FPC plugins cache to disk by default. Not only WP-Rocket does do exactly that, but it also has no built-in way to enable cache storage onto RAM.

So to make it works faster, if you have enough RAM, of course, you may want to optimize how the plugin works, by putting its cache onto RAM.
The way we are going to do that is by mounting its cache directory onto RAM with a single line added to /etc/fstab:

tmpfs /srv/www/example.com/httpdocs/wp-content/cache  tmpfs defaults,relatime,uid=example,gid=example,mode=0750,size=4G 0 0

Where /srv/www/example.com/httpdocs/wp-content/cache is the directory where WP-Rocket stores its cache, example is the PHP-FPM user that “runs” your website (see the article about proper PHP-FPM permissions stack), and 4G says that we allocate up to 4 GB of RAM for storing the cache.

After this, you can run mount /srv/www/example.com/httpdocs/wp-content/cache and the cache directory will live in faster RAM storage, allowing the cache plugin to provide better performance for your WordPress website.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.