Skip to content

How to build your own WPEngine copycat WordPress server on Ubuntu 14.04 with an Ansible Playbook

There is no denying that WPEngine offers the fastest WordPress hosting on planet earth. They’ve invested millions into building the fastest platform possible. That’s why they charge so much money for their services. Because they are worth it. Some of us can’t afford to pay $100-$1000/mo for WordPress hosting. The good news is that if you’re not afraid to get your hands dirty on a Linux command line, you can build your own server that will get you most of the way to a WPEngine class WordPress instance. There are a few key technologies that make this possible.

  • Percona DB (like MySQL)
  • HHVM – A super fast PHP VM
  • PHP-FPM – Just in case HHVM has a problem
  • NGINX
  • Varnish – Awesome reverse proxy cache
  • Memcached & APC

I think you’re probably starting to get the idea. These are the highest performers of the high performance technologies out there. We’re going to make them all work together to make your site blazing fast. It’s not all that hard and it doesn’t take very long.

All you need is a VPS or Virtual Machine running Ubuntu 14.04. Go ahead and SSH into it and we’ll get started.

How to build a WPEngine copycat server for FREE

The server you are working with MUST be able to resolve the hostnames of the sites you’re going to set up, to itself. So, if you are building this to replace a server that’s running and you don’t want to take that site down until everything is migrated, simply add hostname entries mapping the FQDN to the IP address in /etc/hosts.

First thing’s first, let’s make sure your Ubuntu 14.04 installation is updated and upgraded.

sudo apt-get update && sudo apt-get upgrade

Now we need to add the Ansible ppa.

sudo add-apt-repository ppa:ansible/ansible


Let’s update and upgrade everything one more time.

sudo apt-get update && sudo apt-get upgrade

Go ahead and install Ansible and Git.

sudo apt-get install ansible git

Clone the hgv-deploy-full repository, as that’s what were going to use to get everything installed.

git clone https://github.com/zach-adams/hgv-deploy-full/

Now you need to cd to hgv-deploy-full and add your hostname(s) to the hosts file.

cd hgv-deploy-full

nano hosts

Put your hostname in where you see yourhostname.com. If you have more than one, just put each one on a new line, then save and exit.

Next we need to move into the host_vars directory. There you will find a file called yourhostname.com. Change the name of that file to the hostname of your site. If you have more than one hostname, just use cp to copy the same file, creating another using each additional hostname.

cd host_vars

mv yourhostname.com nameofyoursite.com

(if you have more than one hostname, do this)

cp nameofyoursite.com nameoftheothersite.com
cp nameofyoursite.com nameofthenextsite.com

and so on...

Now you need to edit each of those files and set the desired username and password.

nano yoursitename.com

Go up a directory and run Ansible.

cd ..

sudo ansible-playbook -i hosts playbook.yml -c local

This will take a little while. When you’re finished, remove the git clone.

cd ..

rm -rf hgv-deploy-full/

The last step is initializing the installation of MySQL.

/usr/bin/mysql_secure_installation

The default (current) password is blank, so just hit enter, then set a secure password. Select Y for all questions asked. Once that’s finished, all you need to do is restart varnish and nginx and you’re all set!

sudo service varnish restart && sudo service nginx restart

Now, you should see the default WordPress page when you browse to your hostname!

Screen Shot 2015-05-28 at 6.01.19 PM