You probably have already heard of managed WordPress hosting providers like WP Engine, Page.ly and Zippy Kid. One of the big selling points of such solutions is that they have their servers and software stack configured in such a way as to make maximum use of WordPress and the available hardware resources. This means that you usually get a very speedy server that will be able to handle an avalanche of traffic. The downside to using such services however is that they’re rather pricey…
Today we’re going to show you how you can achieve the same performance using a $9/month, low-end VPS configuration.
1. Choosing a VPS
You will want to get a VPS since you will need shell access to tweak things. Shared hosting is a no-go because the “one size fits all” configuration can only be changed by the server admin – meaning that we cannot make any major changes to the server.
So what kind of VPS should you get? Almost any configuration will do. Obviously, the higher the specs – the better, however this guide should work even on a VPS with only 128MB RAM (no, that is not a typo). We aren’t going to name any specific VPS providers as you can easily find them on Google but we will point to Low End Box and their forum for a place that lists many cheap VPS offers. Web Hosting Talk is also a good place to look.
2. Setup & configuration of software stack
When you’re ordering your VPS, you will have the option to choose what Linux distro to have installed on it.
We recommend that you choose either Ubuntu or Debian.
If you’ve never tinkered with VPS before, you will need a SSH client to access your server:
- If you’re on Windows, PuTTY is the most popular option.
- MacOS has Terminal. To access your server simply type
# ssh firstname.lastname@example.org
- Linux distros have built-in SSH support and can use the same “ssh” command as Mac users.
The rest of this guide will have you typing commands in the shell. If you haven’t done this before, don’t worry. The guides we have linked to are easy to follow along and can be completed without knowing the first thing about Linux.
Getting dirty (the long way)
Once you’ve logged in to your server, we will start building our LEMP (Linux, nginx, MySQL and PHP) stack. First of all, we will ditch Apache in favor of Nginx. Nginx is an alternative HTTP server that is more efficient and uses less resources than Apache.
Follow the links below in order to get your stack installed and configured. You will have to input these commands in the terminal and edit a couple of files.
- Initial Server Setup with Ubuntu 14.04
- How To Install Linux, nginx, MySQL, PHP (LEMP) stack on Ubuntu 14.04
- How To Install WordPress with Nginx on Ubuntu 14.04
If you’ve followed everything to the letter, you should have a working instance of WordPress on your server.
Getting dirty (the short way)
The short way of setting up a LEMP stack without inputting dozens of commands is to use a Bash script.
A Bash script is basically a file that encapsulates a number of shell commands. What this means is that you only have to execute the file once and the commands in the file will run without you having to type them. There are a number of Bash scripts that will install and configure the LEMP stack for you.
There’s Xeoncross’ VPS script. This one will also remove a number of seldom used services to free up memory. Usage instructions on the Github page.
Another option is halBox. This offers even more options/interactivity.
In case you have installed CentOS on your VPS, this should be similar to the ones above: Centmin Mod.
3. Configure caching
Now that you’ve got WordPress running it’s time to make it fly.
We’ll want to install data-cache and tweak the built-in zend-opcache module.
After this you will want to install a caching plugin for WordPress. W3TC is the most widely known and best supported: installing and configuring W3 Total Cache with Nginx.
4. Get CDN
Using a CDN will further improve your site’s performance and cut on bandwidth costs by having your content cached across multiple servers around the world. The operation of a CDN is simple: whenever a user goes to your site, they get content served from one of the servers in the CDN network that is closest to them. Although not a requirement, CDN providers offer additional perks to those who upgrade with their plans (DDOS protection, more bandwidth)
- Cloudflare (has a free plan)
- Amazon Cloudfront (also has a free plan)
5. Keep your VPS up to date
You’ve now got a perfect VPS setup that is ready to take on hordes of traffic. What’s next?
You will want to regularly check-in and update the software that is running on your server. If you’re running a Debian-based distro like Ubuntu, all you have to do is type
apt-get update && apt-get dist-upgrade -y
This will update the apt repository and apply any outstanding updates for the software on your VPS.
6. Further tweaks
Logging into your shell and typing commands can get tiring after a while. Luckily you can install a solution that is similar to CPanel, allowing you to tweak your server without logging into PuTTY everytime or having to touch config files in nano.
Get Linux smart
At this point it’s not a bad idea to get some deeper knowledge of Linux, shell commands and how to tweak your server further.
- 20 top most used & common SSH commands
- vpsBible – guides on how to manage and secure a VPS
- An Introduction to Securing your Linux VPS
- How Linux works
Since an unmanaged VPS means that it’s up to you to make sure the server is online (hardware failure notwithstanding), you will want to register for a monitoring service that will keep an eye out and alert you whenever your site goes down.
You’re probably wondering how fast your site is now that you’ve set all of this up. Why not see for yourself with a site benchmark service?