Fastest WordPress stack

Posted June 2, 2017 16.4k views

What is the fastest WordPress stack?

Is it NGINX + Varnish + Memcached + MariaDB + PHP7 + Redis + PHP-FPM? Any tutorials for this setup?

1 comment
  • Mate nobody is using Varnish anymore, esp. for Wordpress. The fastest is always LEMP stack these days.

    Ubuntu, Nginx, MySQL/Mariadb, PHP-FPM, Redis. The harder part is optimizing your Linux kernel, swapfile, PHP settings, and MySQL settings for traffic scaling on small DigitalOcean servers.

    So I suggest ex. SlickStack

    Or another free scripts that will auto-optimize your config.

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
5 answers


As @hansen mentioned, there’s really not an exact rule or formula, and much of what you set up will be dependent on what you need.

As a general rule of thumb, don’t install every piece of software on a single server. I’ve seen far too many do that and the end result isn’t a good one. You’ll end up throwing hardware at the issue, and that’s only viable for the short term – long term, it’ll be a mess.

What I normally recommend, and this, of course, depends on your needs, is to separate as much of the software as possible. By that, I mean one server runs the web server (NGINX) and PHP-FPM, one server will run the database (MySQL/MariaDB), one server will be for caching (Redis)

As a general note, I recommend Redis over Memcached (with a d) as it’s not finicky about what you store to the cache. There’s an excellent, simple to use WordPress plugin that can be used to connect and from there, it’s pretty much hands-free.

That being said, keep in mind that the stack is only part of the equation. While you will need to tweak and tune NGINX, MariaDB, and PHP-FPM for performance, WordPress, WordPress Plugins, and your theme(s) come in to play as well.

You could easily have one of the most well-tuned stacks, but far too many plugins, a poorly coded theme, zero asset minification, large images, etc and that well-tuned stack will mean nothing as the site will still crawl.

Performance is as much front-end as it is back-end.

I’ve seen servers deployed with 4 physical CPU’s (upwards of 40+ CPU Cores), 128-256GB of RAM (or more), and a RAID-10 SSD array with 10-20 disks crumble because they failed to see that performance wasn’t just about having free resources.

At the same time, I’ve worked with clients that have deployed monster droplets – i.e. multiple 32GB RAM / 12 CPU for web, database, etc, only to see me reduce that down to a single 16GB / 8 CPU for the web server, an 8GB / 4 CPU for the database server, and a 4GB / 2 CPU for the caching server.

The cost for 3x 32GB Droplet’s is $960 a month, with what I converted that to, the cost was far less at $280. That’s all due to working with them on the front and back-end to make sure they were set up as they really needed to be.

As far as my auto-installers (thanks for the mention @hansen !), they can be used to simplify much of what you’d need to do on your own.

The NGINX auto-installer is the most complete and comes with tuned configuration. The others, for now, are very basic and simply install software. I’d definitely recommend checking out the NGINX AI as it’ll leave you with a working, tuned NGINX installation (which is compiled from source).

I am working on a newer, more up to date release, with documentation, though I’ll soon be joining DigitalOcean and their Platform Support Specialist team, so much of my time has been spent interviewing and preparing on that front :-). Definitely an exciting time, but that doesn’t mean that I won’t be working on the installers.

If you have any other questions, please feel free to ask. I’ve worked with WordPress sites with low traffic as well as sites that receive upwards of 5-20 million visitors a month.

Hi @nickreiner

There’s no exact rule, since it depends on how your WordPress is configured - meaning, the plugins and theme.

If you’re using Nginx, then PHP-FPM is a given, but you should run PHP 7.1 for speed.
MemcacheD and Redis shares a lot of same functionality, so you should only run one of them.
MariaDB 10.2 is a good choice - better than MySQL.
Varnish is awesome, but very advanced, so it might be easier to setup Nginx and use some cache plugin in WordPress to leverage almost the same speed.
And of course, use HTTP/2 over HTTPS to get faster delivery to visitors.

But more importantly, every service needs to be configured correctly and tuned to deliver maximum performance.

One of the forum users @jtittle has created a very good configuration (including installers). Have a look at the Github repo:

Would be awesome to see a tutorial on Fastest WordPress stack setup on a DO server!!

Could someone explain to me how to install?

“The stack you have most experience” is a good starting point. And this LEMP stack has been quite popular in recent years:

  • SSD/NVMe cloud server like DigitalOcean
  • Cloudflare (at least for DNS)
  • Ubuntu LTS
  • Nginx + FastCGI cache
  • PHP-FPM + OPcache
  • MySQL/MariaDB
  • Redis (for object caching only… helps non-cached queries like cart/checkout)
  • UFW firewall (included w/ Ubuntu)
  • OpenSSL or Certbot a.k.a. Let’s Encrypt (if you use Cloudflare try self-signed OpenSSL… amazing time saver)
  • WP-CLI
  • Git (if you need it)
  • Composer (if you need it)