First of all I have to swear that this has got nothing to do with the current noise about ownai.co.zw. This article was planned ages ago based on my own experiences. Schadenfreude is not really my thing.
One of the things I learnt this year after deciding to avoid shared hosting and opting to go the self-managed VPS route with one of my more popular websites is that: Once the site gains traction and starts receiving a significant number of visits everyday, the default configurations usually do not work well.
This is especially true if you are using WordPress and LAMP on a budget VPS. Sooner than later you are going to get a lot of Out Of Memory (OOM) errors during peak hours as your site gets knocked offline as the Kernel randomly kills processes it deems to be memory hogs. In my case poor Mysqld kept getting murdered and since WordPress relies on Mysql that meant downtime.
In a bid to solve this problem I had to roll up my sleeves and learn, I mean really learn, about Mysql and databases. With the help of a series of experts from all over the globe I was able to: tweak Mysql, configure monit to monitor and resurrect various components in the LAMP stack, configured swap and learnt that swappiness is an actual word. Other experts mocked my installation, I got up in the Apache vs Nginx wars, got bombarded with tens of possible configurations and tweaks most of which were not compatible with one another.
There are so many choices in the Open Source world the choices can be mind numbing. Which distro of Linux should you use? There millions of answers but I solved that one: I prefer Ubuntu. Which web server do should you use? That will draw you into the Apache and Nginx wars which often have sprinkles of IIS, Lighttpd and other lesser known web servers. So should you use LEMP or LAMP what about the Hip Hop Virtual Machine that Facebook has been telling everyone about? Which cache method are you going to use OPCache, Varnish or a gazillion others? Maybe you can select a combination of these? Should you use SPDY and Pagespeed?
I came out of the whole adventure wiser but battered and bruised and traumatised. I was about to give up and give WPEngine a try but whilst I debated the wisdom of paying some guy $30+/month to manage and host my site with the economy what it is somebody suggested I try rtCamp’s Easyengine script.
What is Easy Engine
According the folks at rtCamp:
EasyEngine (ee) is python based command line control panel to setup NGINX server on Ubuntu and Debian Linux distribution for HTML, PHP, MySQL, HHVM, PageSpeed and WordPress sites. It uses an MIT license.
It is a quick and easy way of creating optimised instances of WordPress without the usual pain of wading through multiple configuration files. By design it uses the LEMP stack i.e. Linux (Ubuntu or Debian), Nginx (this is a custom version which comes with built-in fastcgi_cache support.), Mysql and the latest version of PHP. If you do not know what a fastcgi_cache is just know your site will benefit from using it.
To create a fully optimized site you just need to execute the following two commands on a pristine and updated Ubuntu 14.04 LTS server :
wget -qO ee rt.cx/ee && sudo bash ee sudo ee site create yoursite.co.zw --wpfc
Remember to replace yoursite.co.zw with your actual site’s domain name. This creates an instance of WordPress with the w3 Total Cache plugin and the Nginx Helper plugin pre-installed. The Nginx Helper plugin implements what is known as conditional cache purging. It ensures that whenever a post is updated an old copy of it is purged from the fastcgi_cache.
The Easy Engine script comes with a log file:
where it logs all its entire processes and errors. The Easy Engine script also has a configuration file:
The script comes with a lot of bells and whistles including the ability to install various stacks such as plain vanilla LEMP, WP CLI, REDIS, the much vaulted HHVM stack and many more. The site command allows you to install various WordPress installations to suit your needs using various caching plugins, installing in subdirectories or even creating and deleting Multisite installations. To learn more about the various commands and options available go to this help page.
WordPress installations made with this free and open script are impressively fast and can handle an amazing amount of load especially if the number of visits to your blog increase. Some have even claimed that their budget VPS websites were able to handle 5 million hits in test conditions! I would not know about that but I have never lost sleep after I utilised this script and I do think some of you might find it useful.
The great news about the script is that it is transparent and if you do not like something you can always change it either in script’s configuration file or in the desired application’s own configuration file.