Table of Contents |
Web servers are an important component of the World Wide Web. As you learned previously, a web server is a combination of software and hardware that performs the basic operations needed to host resources and sites on the web.
View this video to learn more about the client and server in the transport layer.
Server hardware is made up of a typical or server-grade computer system and operating system. The web server itself, circled in the top left corner of the image below, is software that runs on top of the operating system and uses the computer’s file system, processor, and network card to fulfill its responsibilities. The following diagram represents the basic elements of a web server.
There are lots of web server products to choose from, whether you are looking for specific application uses, low-cost, or a fully customizable solution, there are ideal options available.
Apache Web Server
A free and open-source web server software application that is available for a wide range of operating systems. Also called Apache.
Apache TomCat
A Java-based application server that can host websites as well as web applications. Also called TomCat.
Microsoft Internet Information Service (IIS)
Microsoft’s web server product that runs primarily on Windows operating systems. Also called Microsoft IIS.
NGINX
A free, open-source, high-performance web server. Pronounced “Engine-X”.
Node
An open-source server platform that operates on a wide range of operating systems and provides a platform for building general and special-purpose web servers.
Web servers are the foundation of the World Wide Web and perform a number of functions needed to host sites and resources on the Internet. The basic functions of a web server include:
Server Function | Description |
---|---|
Listen for HTTP(S) requests |
Web servers use the network interface card to listen for HTTP-based requests. The server examines the request to determine how it should respond. ![]() |
Serve pages and resources from a designated directory | Site pages, server scripts, and other resources are hosted within directories within the server’s secondary storage. The web server is configured to search through these target directories in order to find a resource being requested. |
Manage server-side scripting and dynamic content | Since web servers need to handle more than just HTML, such as plain text, CSS, images, etc., the server needs to know what it is in order to process and handle that type of data. Multipurpose Internet Mail Extensions (MIME) types are designations for different types of resources and are used by the web server to determine how to serve the requested resource. Furthermore, requests for scripts and pages that contain dynamic content need to be processed by the proper scripting engine prior to being sent to the client. The server receives the request, examines the requested file’s extension, and then hands the resource off to the configured scripting engine for processing. |
Handle file uploads and downloads | Web servers also host computer files for download and can be configured to accept files from a client through the website or web app and store them in a specified location on the server. |
Manage user sessions and authentication | Web servers also provide mechanisms for creating and managing user-authenticated sessions, access controls, and user management. |
Configuration management | Web servers provide configuration mechanisms for the server, sites, and even specific site directories. The server itself provides configuration options for how the server should behave and respond to client requests. Furthermore, specific sites and even sub-directories hosted on the server can contain their own unique configurations. These site and directory-specific configuration files are often stored in a text-based file in the directory that it applies to. |
Logging and monitoring | Web servers are also responsible for logging activities and requested operations. Whether used for performance management, security, or troubleshooting, web servers offer a comprehensive logging system that can track any number of aspects. Incoming requests, response codes, client IP addresses, timestamps, error messages, etc., can all be logged by the server and used by administrators for a variety of purposes. |
Secondary Storage
Data storage within a computer system that is persistent and non-volatile and is used to store programs and files.
Multipurpose Internet Mail Extensions (MIME)
MIME types are used to associate different types of files and resources to their appropriate extension, which in turn informs the web server how to handle the resource.
Scripting Engine
The collection of code and logic that resides on a server and processes code to create, manipulate, access, and format content for a webpage.
Any computer equipped with a network card and just about any modern operating system can serve as a web server and will work in most use cases. However, in order to ensure that a website performs properly, several factors need to be considered when making the choice of which operating system and web server will be used to host the site. Compatibility, performance, security, and cost are some of the factors that may influence the decision.
Framework
Software packages that are used to improve the speed and efficiency of building software applications.
Open-Source Software
Software wherein the developer has made the original source code available to the community for modification and extension.
Software Stack
A collection of software products that facilitate the development of different software such as websites, web applications, and regular applications.
LAMP is the first, and one of the oldest, stacks. It includes Linux as the operating system, Apache as the web server, MongoDB as the database server, and PHP as the server-side scripting language.
The Linux operating system is open-source, often free, and comes in a variety of distributions, each distribution is modified and equipped for specific uses.
Open-source software, often incorrectly misinterpreted as free, simply means that the producer of the software product has released the software’s original source code to the community and has permitted the community to modify or extend the original code and functionality. This is important as users and developers are free to completely customize the original software to meet their specific needs.
The Apache web server is a free, open-source web server that can operate on a variety of operating systems. Being one of the older web servers around, Apache is not only reliable but is compatible with most of the popular server-side scripting languages.
MongoDB is a source-available database storage solution that provides more flexibility in how it stores information. Unlike other database solutions, MongoDB is considered a NoSQL or non-relational, document-based storage solution that provides better support and performance for web-based applications. MongoDB is a good example of open-source software that is not considered free, although it does provide a free “community” edition.
The last component of the LAMP stack is the Hypertext Preprocessor (PHP) scripting language. PHP is a free, server-side scripting language and library that provides programming features and access to server resources. Typically PHP is embedded within HTML code to create dynamic content and access databases to provide real-time, and up-to-date data. PHP can also be located within stand-alone script files in order to serve as an API (Application Programming Interface), which acts as a translator of data between separate software products.
Together, the LAMP stack provides a robust, powerful, flexible, and low-cost solution for hosting websites and web applications. The LAMP stack is centered around two coding languages, PHP and JavaScript which do require those skill sets.
Next, let’s take a look at the composition of some more recent stacks, MEAN and MERN.
LAMP Stack
A combination of software that includes Linux, Apache, MongoDB, and PHP that offers a low-cost solution for developing and hosting websites and web applications.
Linux Operating System
Linux is a popular family of open-source computer operating systems that was first released in 1991.
MongoDB
A source-available, document-oriented database software application that is available for a wide range of operating systems.
NoSQL
A database storage method that can support different styles of data storage in addition to that standard relational database.
Hypertext Preprocessor (PHP)
A general purpose, server-side scripting language that is primarily used for web development.
Application Programming Interface (API)
Any software that facilitates the transmission of data between different systems that would otherwise be incompatible.
Similar to LAMP, the MEAN stack also utilizes the MongoDB solution. The key difference is that MEAN removes the need for PHP and replaces it with Node, Express, and Angular, all of which are based on JavaScript. Node provides a powerful framework for the JavaScript language that not only enables the use of JavaScript outside of a web browser but also provides the ability to easily program your own web server. Express is an add-on package for Node that makes it even easier to program a web server by greatly simplifying the code.
Angular is a framework for designing interactive, flexible, and professional website and web application interfaces, also referred to as client-side scripting. Angular is based on an expanded version of JavaScript called TypeScript and is primarily used for designing reusable “components” that represent pre-built webpage elements.
MongoDB, Express, Angular, Node (MEAN) Stack
An alternative combination of software from LAMP that includes MongoDB, Express, Angular, and Node, which offers a low-cost solution for developing and hosting websites and web applications.
Angular
A free, open-source framework designed for developing single-page applications and is based on the TypeScript language.
TypeScript
An extension of JavaScript that provides enforcement of explicit data typing of variables and objects.
Finally, the MERN stack resembles the MEAN stack, but uses a different framework for building the site or application interface by replacing Angular with React. React, originally designed by Facebook (now known as Meta), works similarly to Angular in that a developer creates flexible, customizable, and reusable “components” that represent the different elements of a webpage or application interface.
EXAMPLE
A React component can be developed to produce a site’s navigation menu, and the same component can be updated with the user’s current location on the site each time it is rendered. The navigation component’s code would then update the navigation menu’s format to provide an indication of the user’s current location.
Much of the inner workings of React and Angular, however, are different and offer their own benefits and drawbacks. Angular is an entire framework of components, libraries, and native features that provide a robust environment for creating enterprise-grade applications. In comparison, React focuses on performance and render optimization. React by itself is rather lightweight in comparison and only when additional capabilities and resources are needed are they added into the React system. Additional features, capabilities, and libraries can easily be imported from one of the world's largest public software repositories called npm.
Given the variety of choices available to developers and their potential impact on a web project’s overall success, it is important to understand and consider the different factors when planning the approach to the project. From the developer’s perspective, utilizing fewer technologies and coding languages and taking advantage of effective frameworks makes managing web projects less complex. From the organization’s perspective, understanding the direction and overall goals of a web project helps to determine the ideal technology platform for the project.
MongoDB, Express, React, Node (MERN) Stack
A combination of software that includes MongoDB, Express, React, and Node that offers a low-cost solution for developing and hosting websites and web applications.
React
A free and open-source JavaScript library designed for developing single page applications.
Node Package Manager (npm)
A command line utility that allows developers to easily search for and install software packages from the world's largest repository of software.
Source: This Tutorial has been adapted from "The Missing Link: An Introduction to Web Development and Programming " by Michael Mendez. Access for free at https://open.umn.edu/opentextbooks/textbooks/the-missing-link-an-introduction-to-web-development-and-programming. License: Creative Commons attribution: CC BY-NC-SA.