Evan Jacobs

This series is meant to be read in order, so if you haven’t seen Part 1 (Picking the Right Web Host), go do it!

In Part 1, we covered the basic and more technical aspects of choosing a web hosting company – now it’s time to fill the server with software to achieve maximum serving speed.

If you haven’t considered your website’s raw speed in the past, it is now an important component of Google’s algorithmic update, Caffeine. Although relevancy still trumps all other metrics, poor site browsing and loading speed can be enough to knock your site out of the #1 spot in search results.

There are a few main software components to server software, and each plays a role in site speed. There’s an operating system, the HTTP (front-end) server, the interpreting language and the database. Let’s decode each of these terms and find an optimum mix.

**NOTE** If you are on shared hosting, you can’t configure this stuff but it’s good to know!

Operating Systems

There are probably hundreds of operating systems you could install on a web host, but the two most common options are Windows and Linux in one of its many forms. Unless you are developing your website in ASP.net (a Microsoft web framework), I highly recommend choosing Linux for better security, customization and software options (and it’s free!)

In the Linux world, Ubuntu, Debian and CentOS are the most widely seen distributions. Debian is the progenitor of Ubuntu and quite similar functionally (though I personally find it slow to be updated.) CentOS is based off of Red Hat Linux, one of the best known distributions in history, and it is an excellent choice for a web server. I run an Ubuntu server for Brafton.com because it is well-documented and developers in the community are very helpful and responsive to questions. Additionally, Ubuntu development is funded by its parent company, Canonical, negating the chance of platform decay* that can occur with open source projects.

*Platform Decay: The slow death of a software package due to being abandoned or discontinued by its core developers.

Front-end Server & Interpreting Language

This section and the following apply to Linux servers.

Picking a Web Server

On the web, the most common HTTP server is Apache. Apache is extremely versatile and relatively easy to use and configure but, in my opinion, a poor front-end server for any website expecting to get more than 5,000 pageviews a day. It works fine in general, but many visitors connecting at once will use significant server RAM and, ultimately, slow down performance.

There are a ton of alternatives to Apache out there, but we use NGINX (pronounced “Engine X”) at Brafton.com due to its extremely lightweight use of resources and its back-end architecture. NGINX is a little more tricky to set up initially, but has a quickly growing community that was very helpful in our transition from Apache. If you’re interested in seeing some benchmarks, check out WebFaction’s results.

To give a little background on NGINX versus Apache on a more technical level, they handle web traffic using very different models. Apache uses more and more RAM as more visitors come to your site because it opens new connections each time. NGINX uses a specific number of “threads” and simply assigns incoming visitors to one that is already open to maintain low and consistent resource usage, allowing up to tens of thousands of simultaneous connections. The bottom line is NGINX is more efficient.

Picking the Right Interpreting Language

Every server knows how to handle HTML, but if you want to use a Content Management System (CMS) like WordPress, Drupal or Joomla! for your content, you will need to also install an interpreting language. Each of the above systems – and Brafton.com – uses the Hypertext Preprocessor (PHP) language.

I personally find PHP very easy to learn, especially if you have had any experience with semantic languages before, such as C++ or Java. If you are coming to web programming from scratch, there are a ton of free tutorials online and hundreds of books that you will find very useful. There are also other languages you can use – such as Ruby and Python – depending on what kind of applications or CMS you want to put on your server.

If you chose NGINX for your web server, the requirements for PHP are very different. I recommend visiting NGINX’s Wiki to get all the details.

Pro Tip: To maximize site speed, research software like Memcached and a PHP caching solution like XCache, APC or EAccelerator for big speed gains when browsing your site.

Database Software

The most popular database package is MySQL. It’s free, versatile and runs some of the top sites on the web, including Brafton.com. Other options, for the brave and tinkerers, are SQLite, PostgreSQL and even MSSQL (Microsoft SQL Server). Unless you really want to dig in and learn the in’s and out’s of database servers, I recommend sticking with the tried-and-true MySQL.

Assembling the Pieces

The common setup described above, Linux + Apache + MySQL + PHP is called a “LAMP Stack.” If you have Linux hosting (shared or managed virtual private server), chances are this stack is pre-installed and requires little or no configuration. It is perfectly acceptable for a small website with low to moderate traffic (less than 10,000 visits a day).

Brafton.com has more uneven traffic due to the nature of news, so we use what is called a “LEMP Stack.” LEMP refers to: Linux + NGINX + MySQL + PHP. LEMP is a more advanced setup, but is much more adept at handling high volumes of visitors to your site(s).

Here are a few tutorials I found immensely useful when I first was learning how to set up servers:

If you’re still with me, I commend your eagerness to learn! Part 3 will focus on the website itself and how to speed things up beyond fiddling with server settings. Thanks for reading!