Web Servers are software that accept requests via HTTP (Hyper Text Transfer Protocol). HTTP was created to distribute web content such as human-readable pages (called documents). The standard format for these documents is html, however, other digital formats such as images, video and audio can be presented. Non-visual files can also be hosted and distributed on web servers, such as binary files for distributing software, as well as scripts and web applications that run on the client agent, such as the Web Apps, web-based games, and advertising and user tracking "analytics" tools.
The primary client agents for viewing web content are web browsers, such as Chrome, Firefox, and Safari. Web browsers display web documents and execute web applications and scripts for a human end user. However, other agents, such as web crawlers, may also visit a public site.
Web servers are not just used to host web content and documents on the internet. Many network devices, such as embedded sensors, management computers, printers, switches, routers and many IoT systems use web servers to provide management, monitoring, and configuration interfaces. These devices may provide a web user interface that can be used by human users, but for large-scale deployments, they also expose an API to other software and machines. Federated enterprise application and infrastructure management, API calls are used to monitor, configure and manage systems. REST API and SOAP are examples of application interfaces that operate using the HTTP protocol. HPE iLO and Dell iDRAC are examples of embedded software that use web servers to this end. Many cloud services, such as AWS and Azure, also expose a REST API for this purpose.
The following is a screenshot of a web user interface of the embedded management computer on a Dell PowerEdge server (iDRAC):
source: https://en.wikipedia.org/wiki/Web_server
These are basic features that most web servers usually have:
A few other more advanced and popular features (only a very short selection) are the following ones.
There are many Web Server software for various purposes, ranging from management interfaces for network appliances and embedded (such as routers, switches, storage devices, printers, IoT) to full-fledged global websites and applications. Here are examples of some popular web servers for internet server applications:
| Web Server | Type | Use Cases | Key Features | Performance |
|---|---|---|---|---|
| Apache Web Server | Open Source | Hosting static and dynamic content, General Purpose | Wide module support (extensible), robust community | high performance, highly configurable |
| Apache Tomcat | Open Source | Java applications | Serves Java Servlets and JSPs | Moderate, but can handle heavy loads with proper tuning |
| Nginx | Open Source | Serving high-traffic websites, load balancing | Reverse proxy, event-driven architecture | high performance, highly configurable |
| Microsoft IIS | Proprietary | Windows Server ONLY | Integrated with Windows Server, GUI management | Moderate to high, optimized for Windows |
| LiteSpeed | Proprietary | High-performance/Enterprise applications | HTTP/3 support, Advanced caching features | Very high, especially with advanced caching |
| OpenLiteSpeed | Open Source | simpler setups than LiteSpeed, smaller applications | Async I/O, basic caching features | Very high, especially for PHP applications |
| Caddy | Open Source | Quick deployments, automatic HTTPS | Easy configuration, automatic TLS | High, user-friendly setup |
See: https://en.wikipedia.org/wiki/The_Apache_Software_Foundation
ASF is an American non-profit corporation that supports a number of open-source software projects and is the author of the Apache License. ASF has a meritocracy governance model, where membership is granted to volunteers who have made the most contributions to a project. ASF top-level projects are semi-autonomous; however, ASF retains the appropriate intellectual property rights through the Apache license to have the means "to provide legal protection to volunteers working on Apache projects, and to prevent the Apache brand name from being used by other organizations without permission".
The Apache license is a permissive license. It allows users to use the software for any purpose, to distribute it, to modify it, and to distribute modified versions of the software under the terms of the license, without concern for royalties. This license is also used by many non-ASF open-source projects. (see: https://en.wikipedia.org/wiki/Apache_License).
The current version of Apache HTTP Server is a cross-platform open source software released under the Apache 2.0 license. It is an integral part of the web as LAMP (Linux, Apache, MySQL, PHP) is a popular active application back-end for many web-based applications and sites.
The Apache HTTP server has a modular design, meaning any feature can be easily added. Modules can support new protocols, programming languages, scripts, and connections to other services and applications, such as databases. Additionally, Apache2 comes with many included modules that can be easily enabled to add encryption, virtual hosts, application firewalls, and many other functions as needed.
The Apache2 virtual host module is especially useful as it allows many websites or web applications to be hosted at the same IP address. The server can identify which site to serve to the visitor based on a destination other than the IP address, such as hostname, FQDN, Domain, or URL, which would be in the HTTP headers.
The location where a site's assets are stored is called "Document Store". The root of the document store is generally presented to the site clients (visitors), and the displayed URL is relative to the Document Store root. The default location is a directory under /var/www; however, you can specify and change this path in the host configuration. Virtual hosts can have different locations for each site, or even relative paths specified. For example, if enabling a host for each user, a document store can be specified under each user's directory.
You must make sure that you have set the correct permissions for all files and directories, as this directory will be exposed to the network and the internet. The default permissions for static files (such as .html, images, CSS, and other files) are 644 (-rw-r--r--), and for dynamic files and scripts that get executed on the server are 755 (-rwxr-xr-x).
Installation in Ubuntu is fairly straightforward, as Apache2 is already included in the repositories:
sudo apt install apache2
The configuration directory:
/etc/apache2
There are two types of configuration directories:
*-available: These directories are the locations that you should be placing your configuration files or making modifications
/etc/apache2/conf-available: Apache configurations/etc/apache2/mods-available: Module configurations/etc/apache2/sites-available: Websites and Virtualhosts configurations*-enabled: You do NOT modify configurations in these directories. These directories contain links to configurations that you have enabled using the appropriate CLI utilities.
/etc/apache2/conf-enabled: Apache configurations that are currently enabled/etc/apache2/mods-enabled: Module configurations that are currently enabled/etc/apache2/sites-enabled: Websites and Virtualhosts configurations that are currently enableda2enmod: enable module (example: sudo a2enmod userdir, notice there is no need to specify the full path or the extension of the configuration file)a2enconfa2ensitea2dismoda2disconfa2dissiteTo check the status of the service from the OS, use the systemctl or service. For example:
sudo service apache2 statussudo systemctl status apache2Apache2 comes with a utility for managing the service gracefully: apachectl:
sudo apachectl statussudo apachectl graceful: compared to using service and systemctl, this will restart the service gracefully without dropping active transactions and is less disruptive to usersservice apache2 [ start | stop | restart ]apachectl <command>
[ start | stop | restart | status | fullstatus | graceful | graceful-stop | configtest | startssl ]a2enconfa2enmoda2ensitea2disconfa2dismoda2dissite/etc/apache2
/etc/apache2/apache2.conf/etc/apache2/ports.conf/etc/apache2/*-available/etc/apache2/*-enabled/var/www/var/log/apache2