WordPress + nginx + + wp super cache + leverage browser caching

Hi everyone!

It would be awesome if someone could shed some light in the dark for me!

My basic server setup is as follows:

  • Ubuntu 14.04 LTS
  • BIND
  • nginx
  • MariaDB
  • dovecot
  • postfix
  • amavis
  • spamassassin
  • clamav
  • fail2ban
  • ISPconfig3 as a GUI control panel

Using your awesome tutorials I was able to configure fail2ban, optimize it for WP Super Cache and tweak the server here and there.

There is only one thing that confuses me somehow:

  1. What is the optimal way to install caching? I read about memcached, APC, Varnish, Caching plugins such as WP Super Cache and W3Total Cache etc.
  2. What’s the difference between all of these serverside caching moduls like memcached, APC and Varnish?
  3. Do I need them all ? OR Is one sufficient?
  4. If so, which one do you recommend as experienced server admins?

Furthermore I am wondering why GTMetrix tells me that leverage browser caching is not happening on my website, although I see that the site is serving WP super cached files as well when logged-in in my chrome browser and when logged out in my firefox browser console.

I’d be so grateful if there was anyone reading this who knew how to configure nginx/ISPConfig website options and/or my WordPress installation to fix the leverage browser thingie perfectly.

Thank you very much in advance!

Saskia

Hello @saskia,

EasyEngine is moving to Redis for caching (a replacement for Memcached); in that world the config would be:

EasyEngine site with --wpredis switch

It’ll install Nginx-Helper and config it to use Redis

You can then use Redis Object Cache Plugin which replaces a lot of what W3TC / APC etc

There’s probably no need for varnish in front of the full caching that EasyEngine does. Varnish is a proxy cache that stands in front of other httpd services (nginx is actually a proxy as well, but can serve as the main httpd as well).

So basically just create your sites (or convert) with --wp --wpredis and you should be good to go. You’ll need to decide if you want HHVM or not. To convert an existing site do

ee site update example.com --wp --wpredis

Note, converting will remove W3TC so if you are using that to rewrite CDNs or minification you’ll need to plan for that.

We don’t use ISPConfig for our needs, so not much help there. In general we’d rather not burden our VPSs with GUI / Front end tools to admin the sites, they just take resources away from the sites. However, it is pretty straight forward from testing we’ve done.

To Answer your specific questions

  1. Probably just Redis; i.e. --wpredis
  2. Here’s a quickie:
    1. memcached - in memory key value store
    2. redis - more advanced in memory key value store
    3. APC - memcached or redis can replace this; this is an opcache which caches the intermediate processed php code
    4. varnish - proxy server in front of other web servers, with EE don’t need really unless you do some really advanced clustering / load distribution type servicing. Nginx or Apache with process a page and produce output. Varnish with store the resulting output and send that to a client instead of asking nginx or apache to do it. However, nginx with what EE has done is very good at this as well, so unless you really have some advanced scenarios there’s no need.
  3. Redis is probably the way to go going forward
  4. Decision here if you want HHVM or PHP-FPM; RT has done good work to have HHVM with PHP-FPM fall back so provided you have no plugin issues HHVM is probably good (note, PHP 7 may change this).
  5. Also decide if you want Redis Object Cache - if you have memory capacity go for it
  6. Probably for best performance you want an HHVM, Redis with Redis Object Cache site. That’s all. RT says there’s no need for a db cache as MySQL does a good enough job. No need for varnish proxy cache.

Hope this helps - much of this depends on more specifics of the types of sites you’re operating and the amount of memory / processing on your specific VPSs.

Cheers

1 Like

Hi @davidedwards !

Thank you very much for your detailed answer!

This is very helpful!

There is one more question that came up when reading your post: If I decide to install redis on my VPS, there is no longer need for APC, right? I have APC installed you know. So I can just remove it and install redis instead? I am running nginx only. no apache at all.

I am using WP Super Cache instead of W3TotalCache. From what I understood, with redis installed on serverside and configured, WP SuperCache becomes obsolete? Or does this only apply to an installed W3TotalCache plugin?

Thank you again for explaining the differences between those different caching server tools!

Saskia

Redis should cover all your needs (be it that you were on Super Cache or W3TC or any other caching plugin).

@davidedwards

Hi again!

After reading up on redis and trying to implement it with my server, I ran into an issue: my website showed a 502 error.

So Investigated the issue and found out that Redis does not support SSL. :frowning: My site runs 100% via https.

The Redis documentation or somewhere on their website I found a hint, that SSL is not supported. You’d have to use stunnel to be able to use redis with an SSL website. However I found no info on exactly how to implement this with my ISPconfig3.

Do you maybe have an idea?