Share this page:

Linux Web Servers

Linux is one of the most commonly used operating systems in web servers.  It makes sense to use Linux because it's open source, it's free (with a few exceptions), and there's a huge array of sophisticated software available to run on Linux.

The most commonly used open source web server software is Apache, with Nginx being the second most commonly used.  

Apache was released in 1995, and quickly became the most widely used server in the world.  It is well documented, and has a huge user base.  Apache has a range of modules that can be enabled or disabled in order to suit different types of websites.  

Nginx is newer than Apache, but it's gaining popularity quickly.  It has a reputation for being fast and using less memory than Apache.  Nginx doesn't support the ability to execute scripts in the same way that Apache does,  but it can be used in conjunction with application servers that can execute scripts.

Web servers serve incoming HTTP connections using a variety of methods:

  • open a file and send it back to the client
  • execute a script and send the generated content back to the client
  • forward requests to other servers

In the articles in this web site, I'm going to take a look at some of the open source web servers available for Linux, and how to get the most out of them.  These tutorials are aimed at people using Debian based Linux distributions.


Web server basics

Early web sites consisted of HTML and CSS files.  These static sites were good for serving the same content over and over again, but they aren't interactive.  Scripting languages can be used to make sites that display content dynamically.

In dynamic sites, when a web server receives a request from a client it executes a script, and sends output from the script back to the client. The script's output must be in the format of an HTML page.  This allows for interactive sites like social networks, forums and e-commerce sites, where users can post comments and send messages to each other.

Web scripting languages

The following languages are often used to develop web applications:

  • Java - currently tends to be used in complex high traffic sites, object oriented, and highly portable -  'write once, execute anywhere'
  • Perl - not so widely used anymore, but there was a time when Perl was considered to be the glue that held the internet together.
  • PHP - very widely used.  Many site building tools like Wordpress are written in PHP.
  • Python - a general purpose language designed for readability and ease of use, Python is also popular in web development.
  • Ruby - strong emphasis on object orientation. Ruby on Rails is a popular Ruby web programming framework.
  • Javascript - originally a client-side programming language where scripts are downloaded from a server and executed in a web browser, it's now also used as a server-side programming language using the Node.js framework.  Node.js is designed to be efficient and handle large numbers of concurrent connections.


Data in dynamic sites is often stored in a database.  There are many databases available, and they normally fall into two categories:

  1. SQL, relational databases like Postgres, MySQL, SQLite, where data is stored in regular tables,
  2. NoSQL, pronounced "Not only SQL", databases like MongoDB, CouchDB, Cassandra 

NoSQL datbases are used to handle huge data sets, and data that's less structured than data in a typical relational database.

The LAMP stack

There are many combinations of servers, programming languages and databases.  One combination is so common it has it's own acronym, LAMP, which stands for Linux Apache MySQL and PHP. Python or Perl can be used instead of PHP.  

Nginx can be used instead of Apache.  This is referred to as a LEMP stack (the 'E' comes from 'Engine-x').  This site is built on a LEMP stack running Linux, Nginx, MySQL and Python.

Frameworks and Apps

A framework is a library written in a particular programming language that can be used to build complex web sites and custom applications.  Frameworks have a programming API that can be used to do things like process HTTP requests, render/generate pages, manage templates and manage sessions.

An application can usually be used without needing to know how to write code because they have a web-based user interface.  Examples of applications include Content Management Systems, forums, or even social networks.  Many frameworks and applications can be extended with plug-ins.