Chapter 7

Working with Web Servers


  • Tuning Apache for optimal performance
  • Using Nginx for both static and dynamic content
  • Setting up load balancing across multiple servers using Nginx and HAProxy

For the majority of system administrators and web developers, Apache is the automatic choice for a web server. It’s (fairly) fast, powerful, widely used, and available precompiled for most operating systems. Apache is so popular in the Linux world that it’s easy to forget that alternatives exist. Yet, Apache is not perfect, and as web growth has accelerated (and as Ajax has changed the nature of some of this traffic), the need to serve huge numbers of requests has given birth to several lightweight web servers specifically designed with performance in mind.

This chapter examines performance considerations for Apache, before taking a look at the most prominent of the competitors that have emerged in the last decade. This chapter also discusses the challenges that can arise when moving away from Apache, and takes a brief look at caching, front-end proxies, and load-balanced server pools.


The Apache HTTP Server is such an important part of the Internet’s history (and the history of Linux, for that matter, too, since Apache + Linux + x86 quickly became a viable alternative to commercial web servers running on UNIX mainframes in the 1990s). Because of that, this discussion assumes that you have at least a basic knowledge of Apache management and configuration, ...

Get Professional Website Performance: Optimizing the Front-End and Back-End now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.