Recently WPEngine released a new Vagrant machine called Mercury designed specifically for testing development WordPress sites with WPEngine’s specialized High Performance servers. WPEngine has been well known for a long time to provide specialized WordPress Servers which can handle an insane amount of traffic on even the most complex WP sites. For the average Joe who doesn’t know a lot about servers or the details of hosting a popular site this is the perfect setup since WPEngine handles the complicated server stuff and Joe only has to worry about adding content and such. Even for most web development agencies this is a good deal. However WPEngine has one major letdown, it’s expensive as all hell. Now for most people it’s well worth the money and if your site’s popular enough to warrant the specialization WPEngine provides you can easily make it back, but if you’re like me you want that same performance and specialization without the cost. WPEngine uses a lot of customized server setups, however Mercury gives us a glimpse into how WPEngine provides the kind of performance it does, and allows us to replicate it (on a much smaller scale).
An important note before we go any further. This guide is based off of the Mercury Vagrant machine released by WPEngine which was only designed to allow developers to test their WordPress sites before pushing them to WPEngine’s specialized environment. It contains only some of the technologies used by WPEngine, which is why I said WPEngine-Like, however it should get us most of the way to their high performance levels without too much technical stuff.
Picking a Server
The rest of this guide doesn’t matter if your hardware can’t keep up. The reason WPEngine can charge so much is that their servers are top-of-the-line and well-maintained, however we need the same high performance without paying an arm and a leg. For 95% of setups, I would recommend a simple VPS. Personally I would recommend Linode as I find that their support and service to be excellent however I know many people who swear by Digital Ocean and I’ve also never had a problem with them.
Linode (Referral Code, Non-Referral Code)
Digital Ocean (Referral Code, Non-Referral Code)
We also want to be able to scale this server in line with our traffic, however since we’re going for the cheapest we can let’s compare the cheapest plan for both:
IMO go for Linode since it provides you with a little more control over your servers, however both with work fine for our purposes.
Please use Ubuntu 14.04 LTS for the time being!
High Performance Setup
Once you have your VPS up and running and you’re connected through SSH we can start making some magic! I’ve setup two versions for you to choose from:
Full
This one includes:
- Percona DB (MySQL)
- HHVM (Default)
- PHP-FPM (Backup)
- Nginx
- Varnish (Running by default)
- Memcached and APC
- Clean WordPress Install (Latest Version)
- WP-CLI
Basic
This one includes:
- Percona DB (MySQL)
- HHVM (Default)
- PHP-FPM (Backup)
- Nginx
- Clean WordPress Install (Latest Version)
- WP-CLI
Installation
You can find the installations instructions in each Github Repository:
Once it’s done remember to remove the cloned git directory from your server as it’s no longer needed.
If the server is still not running you may need to restart Varnish and Nginx. You can do so with:
sudo service varnish restart && sudo service nginx restart
You’re good to go! A new WordPress install running HHVM should be waiting for you at your hostname!
Speed/Stability Results
All load tests are run with Blitz.io (Referral Link, Regular Link) on a $10/month Linode server with a barebones install of WordPress (Full has W3 Total Cache installed and configured but nothing else). The test is run over 60 seconds and sends a total of anywhere from 15,000 to 25,000 hits to your server.
Basic Setup
Running:
- Nginx
- HHVM
- Percona
- No Caching Plugins
Oh dear. That won’t do at all. As soon as the server took any kind of traffic it spluttered out and threw errors. And that’s even with HHVM! This is exactly the kind of things we need to prevent.
Full Setup
Running:
- Nginx
- HHVM
- Percona
- Varnish
- APC & Memcached (Only Memcached used)
- W3 Total Cache
That’s more like it! Our tiny little $10/month server took 25,000 hits over 60 seconds and only had 1 error! This is exactly the kind of high performance we were looking for.
Security
I highly recommend installing fail2ban, a program which should stop most SSH brute force attacks. You can read on how to install it here. I also recommend a security plugin such as iThemes Security for more WordPress oriented security.
Conclusion
By the end you should have a server that runs close to the high performance of WPEngine, but rather then paying $30/month you’re now paying $5/10 and you can scale at your own rate. It’s also good to remember that YOU are in charge of your own server now, so it’s important to keep it well-maintained and updated.
Let me know if you have any questions or issues!