There are some great managed hosting options available for WordPress, and it’s a hosting niche that seems to be growing quickly. WPEngine, Pagely, and Zippy Kid are usually the three big names you hear when Managed WordPress hosting is brought up in a conversation but sometimes you want a little more control over your website. While it is going to take a bit more than some guides on the internet to make your website scale to the extent those three providers could guarantee this is a great first start step for most sites out there.
This guide will take you step by step through every piece of your hosting environment and should leave you with a speedy stable website that is fairly secure as well. This process is very close to the same process I have used to help a handful of WooNinjas setup their own server.
Choosing your provider
Before I get into any of the configuration or setup of the server and website, I need to choose where the website will be hosted. There are more factors that go into this than just price and specs. Just like anything else you should also consider value, reliability, and support.
One of the providers I typically recommend for hosting is Rackspace and their Cloud Server platform. Their support is one of the key reasons I recommend them, on more than one occasion I’ve been able to get in touch with support late at night and get answers right away. We will be using their most affordable Cloud Server available which offers us 512MB of RAM, 20GB of disk space, and 1 vCPU. This is more than enough to power a handful of websites, and, after bandwidth, will cost about $18 per month.
I am also a big supporter of offloading everything you can off of your main web server. One of the benefits of Rackspace is the extra opportunities it allows us to take advantage of.
Rackspace Cloud Databases – Offers us a managed MySQL instance using lightning fast SSD’s and adds a security benefit of requiring all connections to the database to be within the same datacenter. A single 512MB instance with 1GB of disk space will be about $44 per month.
SendGrid – SendGrid offers Rackspace customers a special free plan for up to 40,000 emails to be sent per month.
Cloud Passage – Cloud Passage also offers Rackspace customers a free plan which will give you an easy to configure firewall and allows you to setup two factor authentication for SSH & SFTP.
New Relic – Last but certainly not least New Relic offers Rackspace customers free Standard monitoring of their servers. The feeling of your fast websites will be backed up by the data you will have through New Relic.
With Rackspace the total cost of running a handful of speedy websites is a little over $60. The number of websites you can run off of this setup is limited only by the amount of traffic each website receives.
Build your platform
When you first login to Rackspace you will be greeted by a page with a big red arrow pointing to a Create Server button, click that button!
You will then enter a server name (“wordpress” will work for our purposes) and choose a region (you want “Next Generation Cloud Servers”).
I would suggest using Ubuntu 12.04 LTS as your OS but Ubuntu 13.04 will work just fine as well. The only requirement is you use Ubuntu. The reason you may want to use an older version of Ubuntu is because every two years a “LTS” version is released and LTS stands for “Long Term Support.” You can visit the Ubuntu wiki to learn more about LTS.
Now just choose the size of your cloud server (512MB) and click the Create Server button one more time and the server will begin building!
Write down the root password that appears, you will not get this password after you dismiss it.
While your server is building you will want to move on over to the “Database” section of the control panel and click “Create MySQL Instance.”
Simply enter an instance name (anything will do), leave RAM at 512MB, 1GB of disk space and be sure to choose the same region as your original server. Below the region you can add a database with a name (wordpress), user (wordpress), and password (your choice – make it secure!).
This database will only be accessible through the private network within the same datacenter, which means would be hackers have one less way to access your data but also that you must plan accordingly. Click “Create Instance” to continue and the database server will begin building.
You will see a really long URL on the next screen, this is what you will enter as your database host when you install WordPress so keep this saved somewhere handy.
By now the server has built itself and you can SSH into it. If you go back to the “Servers” portion of your control panel you should have an IP address for the server and a solid green bar on the left showing that the server is “active” and not “building.”
If you have any issues during this process you can click the live chat button at the top of your screen and get quick help from a Racker right away.
Install the software
This section of this guide is going to get a bit techy-er than the rest. It involves sending commands to a server using your terminal and configuring your software. You do not need to be an expert to copy and paste the commands/files but you should have a basic working knowledge of SSH and how to connect to remote servers.
You will want to use the command below to SSH into your server, but be sure to replace the temporary IP address (184.108.40.206) with your Public IP address. You will be asked for your password that you should have saved earlier so type that in as well, and if you are asked if you want to add the server to the list of known hosts you will want to answer yes.
This first set of commands is going to update and upgrade all the existing software that is installed by default – updated software on your server is always good just like you would always updater your themes and plugins in WordPress. After you’ve upgraded everything the next commands will install the new software (Nginx, PHP, and some basic utilities). The last step is to start Nginx and PHP and make sure they work.
Welcome to nginx!
If you open your server’s IP address in a browser now you should see a blank white page that says “Welcome to nginx!” in it. This means you have succeeded, congratulations!
So far you have run all the commands as “root” on your server, and you do not want your website running under root. I also prefer not to use the “www-data” user on the server either.
To save headaches and just solve all the permissions issues right out of the gate I create a brand new user that will only have access to their home directory. We are going to make PHP run as that user and all of the files will be in that users home directory. When you SFTP into your server that is the username you will use. Since we are installing WordPress the username is going to be… WordPress! I’m sure you did not see that coming.
These next commands are going to create the WordPress user, create a few directories, and then download and unzip the latest version of WordPress from WordPress.org. After that, it ensures the WordPress user is the owner of all the files and resets the WordPress user’s password as well. Don’t worry, you will be prompted to enter a new password so the choice is yours.
We’re not done yet!
You may have noticed your server still is welcoming you to Nginx and not showing you WordPress yet. There are three scripts below for you.
The first is actual commands you need to run, this will delete the default configurations, create new ones, and then restart the services. When you use Nano (or your favorite editor) to edit the Nginx or PHP configurations you will want to copy and paste the entire sample configurations in and save the file. The Nginx configuration is a simple standard WordPress setup, and PHP will use the static process management to always have 3 processes ready at all times but respawn after 500 requests.
Five minutes to install WordPress
After restarting Nginx and PHP if you browse to your servers IP you should see a familiar WordPress installation screen. Simply enter your database information you kept handy from before, pick a nice username (anything but admin!) and password and start pressing your words.
All those tools Rackspace gives you the opportunity to use for free are great, but they need to be installed first. After you’ve signed up for your accounts just run the commands in the script below (be sure to replace the key placeholders with your own) and the server should automatically appear in your control panels for you to configure however you would like.
If you have ever wanted in-depth analytics about how your site is performing or two factor SMS authentication to be able to SSH into your server… these are just some of the features you will get for free!