To me, building WordPress sites and applications is mostly fun — from listening to client’s requirements to showing her the finished site. This process, though, consists of one important, but not very fun part: deployment. Using a cheap hosting solution, with no WordPress optimizations, might work for some but when you want to be sure your client won’t complain of slow site, you need to go for something like Pagely or WP Engine. But that’s expensive. A lot of clients can’t afford that. “Well”, you say, what about buying a VPS server from DigitalOcean and setting it up? In case you are an expert Linux administrator and have a few free days, it will work just fine. For the 99.9% of us, the solution is much simpler. Use EasyEngine to configure the server for you, in just one click (or key press)!
EasyEngine? What’s that?
“EasyEngine (ee) is a python tool, which makes it easy to manage your wordpress sites running on nginx web-server.”1 So basically it’s a collection of Python scripts allowing us to transform an Ubuntu or Debian based VPS servers into something like what Pagely or WP Engine offer, for free. It might seem too good to be true but it actually works, I’ve just tested it. Before diving into details, let’s see how to download and use it. Note: to be able to follow this guide, I assume that you have basic command-line skills and know what ssh is.
Firstly, we need an Ubuntu server to play with; for that, DigitalOcean.com is a perfect candidate due to fast SSD disks. Create a DigitalOcean account through my referral link which will award you with 10$ in credit. That will be enough to test EasyEngine.
Now, ssh into the newly created server (I will call it playground server) and run this command:
wget -qO ee rt.cx/ee && sudo bash ee
It downloads and installs the application ee (short for EasyEngine) into the global path so we can use it from anywhere. Are you ready to have the server configured and WordPress installed?
Configuring server and installing WordPress with EasyEngine
To install a standard WordPress site with domain your-domain.com with Nginx2, PHP-FPM2 and MariaDB (similar to MySQL), execute the following command in your playground server’s command line:
ee site create your-domain.com --wp
EasyEngine happily installs this software with standard WordPress, configuring it for the best performance along the way. The only thing to do now is to note the WordPress admin username and password and point your-domain.com to the server’s IP address.
The WordPress site was downloaded into
/var/www/your-domain.com folder, which includes these files/folders:
conf/ htdocs/ logs/ wp-config.php
wp-config.php is the main configuration file for your WordPress-powered site (as you know). Folder htdocs/ contains the site itself (wp-content, wp-admin, etc). Folder conf/nginx/ is very interesting — you can put Nginx configuration files there and they will be included in the main Nginx configuration file for your domain (site). That means it is straightforward to add any additional request rules if you need. But that’s more advanced, let’s continue. Finally, folder logs/ contains the access and error logs of your site. Awesome, this way I don’t have to look for them for half an hour as they are in a single place.
EasyEngine comes with some supplementary commands for working with the site: here they are.
I want the server to be faster
I’ve been waiting for this moment so long, thanks for asking! We’re going to make use of Nginx FastCGI page caching3 and replace PHP-FPM with the unbelievably performant HHVM PHP interpreter4.
Firstly, let’s update the site to have the page caching. Execute the following command at the servers’ command-line:
ee site update your-domain.com --wp --wpfc
This command sets Nginx to do FastCGI page caching, as well as installs the W3 Total Cache WordPress plugin, configuring it to use Memcached (similar to Redis5) for database and object caching.
Secondly, let’s update the site to use HHVM instead of PHP-FPM. Execute the following command:
ee site update your-domain.com --hhvm=on
Finally, please, test the speed of the site6. Wooah, so faaaast. No, but really — it should get 2-5 times faster (or even more). At what cost? Just read my book7, there’re plenty of goodies in it!
It’s time for some pros and cons — I wouldn’t write an article without them!
All in one
EasyEngine is the number #1 all-in-one solution for managing your WordPress web servers, without a doubt. It comes with plenty of commands, from creating a site, through cleaning the caches to installing utilities such as phpMyAdmin and others.
Pro stuff: speed optimizations and security
It’s not hard to install Nginx nor HHVM; what’s really challenging is to configure them properly. Do you know how to enable gzip or how to block malicious users from running their scripts on your server? I do, but I have a fetish in late-night reading, you know. The point, however, is to do as little as possible and that’s where EasyEngine shines. It comprises carefully crafted configuration files with emphasis on performance and security8.
P&P: Python and plugins
The new version of EasyEngine (v3+) was rewritten in Python with a pretty neat code structure. It’s easy to understand and grasp hold of. What is more, if you miss a functionality, you can write a plugin to extend EasyEngine’s core. Looking at some of their plugins, I’m stunned by their simplicity. No boilerplate code, just the good parts. Can’t resist writing a one…
Although EasyEngine is an open source project, it was started and is maintained by a professional WordPress agency rtCamp. I know them from their articles on Nginx and optimizing WordPress performance. They were my first introduction to this problematics and I trust them.
Ansible is an automation tool used to set up your server(s) completely. In some ways, it is a direct competition to EasyEngine, as it can be used to do the same stuff. While the former is rather a flexible tool, the latter is limited to a few WordPress-related tasks. Therefore, advanced system administrators may find EasyEngine too narrow for their purposes.
To show you where Ansible shines over EasyEngine, it doesn’t have to be installed on the server (it’s used from your PC) and has the capability to execute the tasks on multiple servers at once.
Are you considering becoming an expert server administrator? Study Ansible.
Better be used on a fresh server
What if you already have a WordPress web server, wanting to migrate it to EasyEngine? Well, it won’t be easy like running the aforementioned commands. EasyEngine likes to take full control of your web server. While it can be done, I recommend reinstalling it and letting EasyEngine do its work.
- if you are a skilled WordPress developer (programmer) who likes to tinker and learn new things, use Ansible
- else if you use Bedrock, use Trellis (their Ansible playbooks)
- else if you do have basic command-line skills, use EasyEngine recommended
- else if you don’t have basic command-line skills, use Pagely/WP Engine/SiteGround
- else learn a bit more first and pass the project to a more skilled developer; your client will thank you later.
Despite its shortcomings, EasyEngine is mostly fine — you won’t be using it for BigCo kind of sites anyway. But if you really need that support and assurance and have the required budget, go with Pagely/WP Engine. EasyEngine can’t (yet) speak with you. Otherwise, DigitalOcean + EE combo will get you very far.
- EasyEngine on GitHub ↩
- Nginx and PHP-FPM explained in book “WordPress Performance Optimizations” ↩ ↩
- Nginx FastCGI page caching explained in book “WordPress Performance Optimizations” ↩
- HHVM explained in book “WordPress Performance Optimizations” ↩
- Redis explained in book “WordPress Performance Optimizations” ↩
- Using Loader.io for load testing your site ↩
- WordPress Performance Optimizations ↩
- EasyEngine templates of configuration files on GitHub ↩
Can you write tutorial of SlickStack script for Nginx too?
Leave a comment