You are reading this article from a website powered by an open-source web server simply because open source web servers power over 80% of websites and applications. The term web server can be used interchangeably to refer to the hardware or software used to serve content to end-users or clients over HTTP.
Web servers have been under development and constant improvement since the early 90s. There are different types of web servers, and they can be built for specific needs, for certain technologies, or as special options for certain corporations.
This article will list some of the reliable and popular open source web server projects available for you to install and get your application or website running.
Open Source Web Servers for Linux
A web server can refer to the entire hardware and software system, or specifically to the software that accepts and serves the HTTP requests from clients.
As software, a web server controls and manages how hosted files are served to clients. It can be an HTTP server that understands URLs and the HTTP or HTTP/2 protocols.
Whenever a user, like yourself, needs a file or information hosted on a web server, you will use a web browser to make the request. The request is sent to the relevant web server (hardware), where the HTTP server accepts the request, finds the appropriate file, and sends it back to the client browser through HTTP.
A static web server will send hosted files as-is to your browser.
A dynamic web server contains a database and an application server that updates the hosted files before sending them to your browser via HTTP.
1: Apache HTTP Web Server
Initially released in 1995, it is the most popular web server. According to usage statistics of web servers from w3tech.com, Apache powers around 33.9% of web applications and websites in the World Wide Web. It is released under Apache License version 2, which requires preservation of the copyright notices and disclaimers, but doesn’t require modified versions to be distributed using the same license. It runs in all popular operating systems like Linux, Unix-like, Windows, Mac OS X, FreeBSD, Solaris, Novell Netware, OS/2, etc.
Apache HTTP is written in C language and uses a modular architecture that is highly customizable, and it can load extra modules to extend its features. These include the mod_proxy, which will allow for a proxy/gateway on your server, mod_proxy_balancer will enable load balancing for all supported protocols. mod_file_cache for caching, mod_ftp for FTP support for uploads and downloads, or mod_ssl for SSL/TLS encryption protocol support.
Other notable modules include the proxy module (mod_proxy), mod_rewrite (URL rewriting module), mod_include, and mod_ext_filter.
Apache also features a popular compression method included in the external extension module, mod_gzip. It has been built to help with reducing the size of Web pages served over HTTP. The custom logfiles (mod_log_config) manage log files that can be analyzed through a Web browser. It features ModSecurity to manage intrusion detection and prevention for Web applications.
- Loading of dynamic modules and handling of static files.
- Support for HTTP/2 (mod_http2), IPv6, and compression.
- Custom logging and rotation, IP address-based geolocation.
- Support for session tracking, CGI support, FTP, and XML support.
- Implements high concurrency using MPM and FastCGI modes.
- URL rewriting, fine-grained authentication, and authorization access control.
- Fault tolerance and failover handling.
- It implements per-directory configuration through .htaccess files.
As of version 2.4, Apache supports HTTP/2 through the mod_http/2, which improves performance. Apache was considered slightly slower than Nginx (asynchronous, event-driven web-server), which led to the increased adoption of Nginx, but users have witnessed improved performance since Apache 2.2.
2: Apache Tomcat Web Server
Apache Tomcat is a popular enterprise-level web server available in the market. It is build to host Java web-based solutions whose usage is relatively frequent and abundant in large organizations due to high scalability, performance, and the number of tools available for the Java ecosystem. Apache Tomcat is a matured web server whose creation is credited to James Duncan Davidson from the Apache foundation. Tomcat has been under development for over 20 years ago by Apache software foundation as the Apache webserver.
Tomcat is a Java servlet that comes with extended functionality for interacting with Java servlets, and it implements technical specifications such as JavaServer Pages (JSP) and Java Expression Language (Java EL).
Tomcat is made of multiple components like Coyote, Catalina, Jasper, Cluster, etc. Catalina is the servlet container, while Coyote is the connector component that supports HTTP 1.1. as the Web server. It allows Catalina (Java servlet or JSP container) to act as a Web server that serves local files as HTTP documents. Jasper is Tomcat’s JSP engine, and it parses JSP files to compile them into Java code as servlets. The Cluster component manages large applications through load balancing and other techniques.
You can run Apache Tomcat alongside Apache HTTP to facilitate projects with both Java and PHP. Tomcat also supports AWS (Amazon Web Services), making it ideal for cloud-based solutions. The Eclipse IDE supports Tomcat, making it easy for developers to create and deploy applications.
- It is lightweight, very stable, and highly flexible.
- It boasts an extra level of security, TLS virtual hosting.
- It supports web application memory leak protection and detection.
- Supports HTTP/2 and OpenSSL.
- Advanced IO capabilities and refactored clustering.
Apache Tomcat web server is a better option for Java web-based applications. Apache Tomcat is often listed among other open-source Java application servers like JBoss, Wildfly, and Glassfish.
3: Nginx Webserver
Nginx read ‘Engine-x’ is an open-source, high-performance, and robust web server. It can be deployed as a load balancer, reverse proxy, IMAP/POP3 proxy server, and API gateway. Igor Sysoev developed it in 2002 as an answer to the C10K problem. The C10k problem is a problem of optimizing network sockets and web servers to handle ten thousand concurrent connections and clients. Nginx has grown in popularity running approximately 33.7% of all websites.
Nginx relies on an asynchronous event-driven architecture to handle large numbers of concurrent sessions. It has become popular among administrators due to its low resource utilization, high concurrency, and scalability. It is ideal for hosting high-traffic websites, and it can handle up to 500,000 requests per second with low CPU utilization.
Nginx can be used as a standalone Web server or as a static content server in front of another web server. Moreover, you can deploy Nginx to serve dynamic HTTP content on the network using SCGI handlers for scripts, FastCGI, WSGI application servers, or Phusion Passenger modules.
- Supports TLS/SSL, OCSP stapling, gRPC, IPv6, and HTTP/2.
- It can handle over 10,000 concurrent connections with low CPU memory.
- It supports SMTP, POP3, and IMAP proxy.
- It can be configured as a reverse proxy to implement caching.
- Supports modular architecture filters like gzipping, byte ranges, chunked responses, XSLT, SSI, image transformation.
- Support IP address and name-based virtual servers.
- WebSockets, keepalive, and pipelined connections
Nginx has two established versions, OSS Nginx and Nginx Plus. Nginx Plus offers additional features such as active health checks, sessions persistence, DNS-service-discovery integration, Datalog, Dynatrace New Relic plugins, a cache purging API, AppDynamic, Active-Active HA with configuration synchronization. The Nginx Plus API supports key-value stores.
Nginx was designed to compete with the Apache server to serve static files, use less memory, and find answers to the c10k problem. We can confidently say it beats Apache hands down in this category. That is why it has been deployed by popular high traffic websites like Facebook, LinkedIn, and Twitter. Learn more about the project from the official Nginx homepage.
4: Node.js Webserver
The Node.js project is governed by the Node.js Foundation and is available under a mix of licenses. Find out more from the Node.js project’s website.
5: Caddy Webserver
Caddy is a fast and powerful multiplatform web server, reverse proxy, API gateway, and load balancer. The Caddy project was designed by Mathew Holt and written in the Go language. It is a new framework and is strongly gaining following and attention in the open-source framework as an alternative to Apache Web Server.
Caddy is built with no dependencies making it portable and easy to install and use across various distributions. Caddy supports features like IPv6, Markdown, WebSockets, FastCGI, templates, etc. Caddy activates HTTPS by default for sites with qualifying domain names and redirects HTTP requests to HTTPS. It obtains certificates during startup and keeps renewing them during the lifetime of the server.
Interestingly, it has an ‘on-demand TLS’ feature, which offers an alternative configuration method that allows Caddy to obtain certificates only as needed during TLS handshakes. It is available in all major distribution like MAC, Windows, Android, Linux, BSD, and Solaris.
- HTTPS is enabled by default, and HTTP/2 also gets primary focus.
- No dependencies, and the Golang codebase does not depend on any underlying system libraries.
- Supports IPv6.
- Serves FastCGI, Gzip compression, and headers.
- Supports directory browsing and servers static files in the current working directory by default.
- Supports VirtualHost, load balancing with health checks.
- Caddy can be embedded as a library in other programs.
Caddy is a great candidate for the user who seeks simplicity and is happy working with default configurations. It’s an ideal web server for running applications written in GO. According to w3tech, it currently powers 0.1% of all websites.
6: Eclipse Jetty Webserver
Eclipse Jetty is designed and built as an HTTP server, HTTP client, and javax servlet container to serve static and dynamic content as a standalone or embedded instance. The Jetty Web server and other core components are hosted and maintained by the Eclipse Foundation.
Jetty is a lightweight and highly scalable Web server and servlet engine. Jetty is a fully async Web server that is component-oriented and can be easily embedded into other applications. It supports Web protocols like HTTP, HTTP/2, and WebSocket. These technologies implement a high-volume, low latency, maximum performance architecture while retaining its simplicity and compatibility. It can achieve excellent results with tens of thousands of simultaneous HTTP connections and WebSocket connections.
Jetty has a small footprint which enables web developers to efficiently deploy and configure Jetty in any environment without worrying about the unwanted overhead or memory usage. With a small memory footprint, you can run more server instances on virtual hardware, making it a good option in cloud deployments and infrastructure.
- It is asynchronous, scalable, and highly extensible.
- Has a small footprint.
- Supports OSGI, JMX, JNDI, JASPI and AJP.
- Supports HTTP/2, WebSocket server, Java ServletAPI with JSP.
Eclipse has found adoption in many projects such as Apache ActiveMQ, Google App Engine, Alfresco, Apache Geronimo, Apache Maven, Apache Spark, Eclipse, and Twitter’s Streaming API. Find out more here.
7: Lighttpd Webserver
Lighttpd or Lighty is a free and open-source web server built for speed-critical applications. It is secure, fast, flexible, and has a minimal footprint of less than 1 MB. Its small footprint makes it very economical with the server’s resources and CPU utilization. Lighttpd is distributed under the BSD license and is favored for its simplicity, performance, and support modules.
Lighttpd is built on an asynchronous request handling model, which is essential in handling and managing a large volume of parallel connections making it an ideal option for high-performance web applications. Some might say it mirrors the architecture in Nginx. It supports FastCGI, CGI, and SCGI for interfacing your web server with other programs. It also supports applications written in other languages such as Python, Perl, PHP, and Ruby, which are popular development languages among developers.
Other advanced features in Lighty include; Auth, URL-rewriting, support for SSL/TLS, virtual hosting, and HTTP output-compression through the mod_compress module.
- Supports TLS/SSL with SNI via OpenSSL.
- It supports HTTP/2
- It implements flexible virtual hosting.
- Supports chroot and authentication against LDAP server.
- Supports modules such as mode_deflate and mod_compress for HTTP compression.
- It implements an efficient event notification mechanism using technologies such as kqueue and epoll.
Lighttpd is a single-threaded web server that can easily handle a few hundred requests per second and is a good option for users facing challenges in low-memory and low-CPU environments. Lighty runs natively on Linux/Unix systems, but you can also run it on the Microsoft Windows platform. Please find out more about its usage statistic, licensing, and support on the Lighttpd homepage.
8: OpenLiteSpeed Webserver
OpenLiteSpeed is an open-source alternative to the LiteSpeed Enterprise Web server edition. It is built for simplicity, security, optimization and comes with all the essential features in the Enterprise edition.
OpenLiteSpeed is designed on an event-driven, resource-optimized architecture. It comes with an intuitive WebAdmin GUI to manage websites and monitor different sets of server metrics. OpenLiteSpeed is optimized to execute scripts designed in a wide range of languages like Perl, Python, Ruby, and Java. It supports IPv6 and SSL/TLS.
- It is compatible with the Apache mod_rewrite module, making it easy to migrate existing Apache files.
- The event-driven architecture results in high throughput.
- It features a user-friendly GUI admin interface.
- It implements Google PageSpeedInsights optimizations and intelligent-cache acceleration by default.
- It can handle thousands of concurrent connections.
OpenLiteSpeed is versatile, and you can configure it as a load balancer or reverse proxy. OpenLiteSpeed is free to download and is available under the GPLv3 license. It is a good option for WordPress-based content websites.
9: H2O Web Server
H2O is a new generation open-source HTTP server. It boasts quicker response times with less CPU utilization’s as compared to older generation web servers. H2O is designed and built from the ground up to create full-featured HTTP/2 implementations.
Users of H2O can take advantage of new HTTP/2 features such as latency optimization, server-push, prioritized content serving, and server push. These features can take advantage of modern browser functionality.
- Supports HTTP 1.0/1.1/, HTTP/2.
- Supports TCP Fast Open.
- Supports WebSockets and TLS.
- It supports server push, negotiation methods: NPN, ALPN, upgrade, direct.
H20 is written in the C programming language and can also be used as a library. H2O is available under the MIT license. Find out more about H2O usage statistics.
10: Cherokee Web Server
Cherokee is a lightweight, fast, flexible, and performant open-source, cross-platform Web server. It was developed as a personal development project but has grown into a decent web server that runs on Linux, BSD, Solaris, MAC, and Windows.
Cherokee makes our list because of its simplicity. It comes with a friendly web-based interface, and you do not have to master many command-line configurations to get it running and working.
It supports technologies such as FastCGI, CGI, SSI, SCGI, PHP, TLS, and SSL encrypted connections, VirtualHosts, load balancing, and Apache compatible log files.
Cherokee can handle concurrent connections on low memory and enhances hardware performance. It has a modular architecture that can be modified and extended through an administration wizard to perform specific tasks, extend applications, and run frameworks.
- It can be configured as a reverse HTTP proxy.
- Server-side includes (SSI) on gzip and deflate compressions.
- Supports chroot and RRDtool statistics.
- Supports video streaming, content caching, etc.
Despite it not being actively developed, it is a good web server for simple projects. It supports PHP, Django, Ruby on Rails, ColdFusion, Alfresco, Symfony, GNU Mailman, .NET with Mono, rTorrent, and Zend Engine, which gives you many alternatives to build your project.
Learn by trying
If you are getting started on web servers, try out the LEMP (Linux, Nginx, MySQL, PHP) or LAMP(Linux, Apache, MySQL, PHP) stacks. You can easily install these stacks using simple installers and are also available in your Linux package manager. It will give you a broad hands-on experience on how web servers work.
I have included some popular web servers (Apache, Nginx), newer ones (H2O, Node.js) and looked at the Jetty web server supported by Java technologies. The list is by no means extensive, and with more research, you can discover other web server technologies to try out or use for your project.
The following application server is a good choice if you are using a small and/or embedded Linux system.
The code can easily be cross compiled as follows:
wget -O – https://raw.githubusercontent.com/RealTimeLogic/BAS/main/LinuxBuild.sh | bash