Optimal Wordpress Setup Using Varnish & ngx_pagespeed

Posted February 23, 2015 5k views


I was hoping to get some advice on the best solution for a wordpress site. The site itself is very niche based and seasonal so it doesn’t get a lot of traffic. At most, we’re looking at about 150 visitors per day. Most installations can handle this and this isn’t my issue.

My issue is that I cannot use a caching plugin and without caching speed is very drastically affected. The reason I can’t use a caching plugin is because I use an availability calendar on several pages. This calendar is ajax based and very often I find that it renders as -1 on the page. This is apparently a common issue when using caching plugins and ajax.

So, I need my pages to load fast and to deliver an optimized experience to my handful of site visitors.

My initial thoughts are:

  • ubuntu
  • nginx
  • varnish
  • APC (for opcode caching)
  • ngx_pagespeed

I am looking at deploying the above without using any caching plugins. Can anyone see a downside to this? Is there a better solution that will deliver fast page loads and TTFB? Can I do this on a 1GB account without issues?

If anyone has tutorials on here that can guide me through the best setup, I would really appreciate it. I have followed quite a few in the last 2-3 days but always seem to have an issue when trying to compile nginx from source for ngx_pagespeed. I’m also uncertain on how to get varnish into the mix.

Appreciate any and all suggestions.


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

You could specify in your web server’s configuration a number of HTTP headers to disallow the caching of your availability calendar. Headers that could be useful would include expires and cache-control.

Try best option for beginners.

  • Hi EpicCDN,

    Thanks, that looks very interesting. I’ve managed to put together a server with nginx, pagespeed, php, memcache and mysql. I’ve also installed wordpress.

    I haven’t got a site on this setup yet but it already seems to have exhausted my 1GB plan:

    Not sure if I’ve done something wrong or if I simply need to go onto the larger plan.

  • Free memory is actually both Free Memory + Cached Memory (so you have 731MB free), last one is just reserved for use, not really used. so it looks good so far, yet you may need to test with real usage before considering an upgrade, also try adding to your mix to decrease server load.