This guide entitled Setup Nginx on Centos 6 to run Drupal is designed to walk you through the process of preparing a VPS to run Centos, Nginx for the purpose of running Drupal CMS / Framework.
Setting up a Centos box to run NGINX is slightly different to setting up a Centos box to run Apache. Now if you haven’t done this before, it is going to take a bit of learning as NGINX is noticably different to Apache. Also for some, including me it is a little disconcerting being out of your apache comfort zone. So why bother? Speed that’s why – NGINX is lighter and faster at serving up those Drupal web pages than trusty old apache. Fast web pages are very important from the point of view of both your users and that of google. Now since both your users and google like fast web pages you will want to make your Drupal site as speedy as possible. NGINX will help with that.
Choosing a Hosting Provider
Choosing hosting is a bit of a mine field. I have had a few miserable experiences with hosting over the years so nowadays for most projects I tend to use Linode or Digital Ocean. In this write up I am going to use Digital Ocean as you get “a lot of server” for your money with them – although Linode is pretty good value too (and awesome support).
Sign Up and Fire Up your Centos Server
Head over to Digital Ocean and sign up for an account. Now obviously as with most cloud providers, you need to put your hand in your pocket and pay for hosted service. Digital Ocean starts at $5 PCM which is about £3 in real money :).
Once you have signed up and logged in you will need to create a Centos server (or droplet to use Digital Ocean talk)
This is straight forward as there are two buttons labelled “Create” and a “Create droplet” presented to you on the first page. Click either of them as they both do the same thing – they start off the create process.
The first part of the process requires you to enter a little detail and choose the size of the server you want to rent and Linux operating you wish to run.
So like they ask go ahead and enter a hostname, in my example I use the utterly ridiculous name of myserver.mydomain.com. I am sure you would use something far more sensible like yourserver.yourdomain.com or whatever.
Next choose how big you want your server, I am going to choose 512mb. That’s should let you run a NGINX server with enough room to serve up a small traffic site of Drupal comfortably. You might be thinking but what happens if my site gets bigger will 512mb cut it? Don’t fret – this is the cloud and you can just upgrade the ram in increments (512mb, 1gb, 2gb etc) without starting all over again!
Choose the region you want the server to be hosted in – if you are hoping to target users in the U.K you should choose a server nearest to them. There isn’t an option for London yet but Amsterdam 2 should do the trick (Linode have an option for London so check them out if you really need UK hosting)
Next choose the type or “flavour” of Linux you want to install. This tutorial is based around Centos 6 so let’s install that. Although for a 512MB server you won’t particular benefit from a 64 bit O/S but if you want to upgrade the server to 4GB or above then the O/S will need to be 64 to benefit. So let’s assume you are going to be successful and someday need 4gb so choose Centos 6.4 x64
Click the Centos Tab and the CentOS 6.4 x64 option then press the big green button “Create Droplet”
After a few moments the server (or droplet) will be built and you will be presented with screen which will let you take control. You will see an IP address in the example shown we have IP of 22.214.171.124 (I made that IP up in the interest of security you understand), make a note of the IP displayed on your screen as we are going connect to the server and begin configuring. Oh yes, also make a note of the root pasword that digital ocean sends you. You will need that (and don’t forget to quickly change the root password it as it is fairly weak as passwords go).