Which open source web server is right for you?
When it comes to web servers, Apache is the leader of the pack in terms of web site numbers and growth. However, there are alternatives out there that might be just as good for your company or project.
Since launching in 1995, Apache has become the most popular and widely used web server and was the first to hit over 100 million websites in 2009. It turns 20 years old this month, and has to this day remained free and open source.
Seeing as Apache has taken a lot of the cake in web server statistics for a while, we thought it would be worth looking at what else is out there in the open source space – whether you’re looking for speed, reliability or security, the following options could be right up your alley if you’re looking for an Apache alternative.
Nginx is the new number two web server you’ll hear developers using after Apache: the HTTP and reverse proxy server was built by Igor Sysoev and offers English and Russian support. On top of being open source, it also provides commercial subscriptions and professional services to customers using the server in production environments under the Nginx, Inc. banner.
On top of HTTP and reverse proxy, Nginx incorporates mail services with an Internet Message Access Protocol (IMAP) and Post Office Protocol (POP) server. Being events-based and having a small memory footprint, Nginx doesn’t spawn new processes or threads for each web page request, meaning that even as the load increases, memory use remains predictable. This allows the server to handle very heavy user loads with minimal resources.
The latest data from Internet services company Netcraft shows Nginx served or proxied 21.09% of the busiest websites last month (Jan 2015), with companies such as Netflix and WordPress amongst their clients. The team behind Nginx are committed to keeping the open source version of the server functional and up to date.
Lighttpd (pronounced ‘lighty’) was originally built by Jan Kneschke and is described as being optimized for speed-critical environments while remaining standards-compliant, secure and flexible. It boasts support for FastCGI, SCGI, authentication, output-compression, URL-rewriting and effective management of the CPU-load, making it an option if you’re experiencing load problems.
While originally being written as a proof-of-concept of the C10k problem, its popularity peaked with companies such as Youtube and Meebo attributed as users. While they have now moved on, high-traffic sites such as xkcd.com are still relying on its ability to serve static media separately from dynamic content. Configuration is very similar to Apache, with exception to the syntax used.
Hiawatha is an advanced web server for Unix systems and is described as secure, lightweight and easy to use. Created by Hugo Leisink in 2002, an emphasis on Hiawatha is its small size being ideal for older hardware or embedded systems.
Compile and run tests of Hiawatha have been successfully completed on Debian, Ubuntu, Gentoo, Fedora, Slackware, FreeBSD, OpenBSD, NetBSD, MacOS X, Solaris and Cygwin. Because of the use of a platform-independent build system, Leisink believes it’s very likely that Hiawatha will compile and run on other Unix-clones as well.
Features of the server include access control via Basic / Digest HTTP authentication or IP address, CGI and FastCGI (including a CGI-wrapper for better CGI security), reverse proxy and URL-rewriting. Security is underlined as one of the key features of the server, with support for SSL (via PolarSSL), protection against SQL injections, cross-site scripting (XSS), cross-site request forgery (CSRF/XSRF) and DoS attacks.
Cherokee is a cross-platform server created by Alvaro Lopez Ortega. It has been designed to be fast, flexible and easy to configure with support for FastCGI, SCGI, PHP, CGI, SSI, TLS and SSL encrypted connections, plus virtual hosts, authentication, load balancing and reverse HTTP proxy.
The server is described as extremely lightweight and provides an interface called cherokee-admin, which helps to configure every feature of the server, including the editing of text files without using the required syntax. It offers native performance for Unix, Linux and Windows systems, as well as being completely modular. Its comprehensive documentation library is available here.
With the above four options, we’ve only reached the tip of the web server iceberg. Depending on your project, other options out there include Jetty, Mongoose, thttpd and Yaws, however the list of public web servers is huge and worth taking a look at.
Node.js is also gaining traction as a server-side platform, which contains its own built-in library to allow applications to act as a web server without software such as Apache.
What are your favourite open source web servers to use? Let us know in the comments below.