A web server can be software, hardware, or these working together. Regarding software, a web server comprises parts that control how web users access hosted files.
The minimum is an HTTP server that understands HTTP (protocol a browser uses to view web pages) and URLs (website addresses). An HTTP server is accessible via domain names of the websites it stores and delivers content of hosted sites to end-user devices.
How Does a Web Server Work?
A browser requiring a file hosted on a web server requests it via HTTP. First, the request reaches the correct web server (hardware). Then, the HTTP server (software) accepts the request, finds the document, and through HTTP, sends it back to the browser. If the document isn’t found, a 404 response is sent instead.
The Difference Between a Static & Dynamic Web Server
To publish a website, you need a static or dynamic web server.
Static Web Server
A static (or stack) web server comprises a computer (hardware) and an HTTP server (software). It is ”static” as the server sends your browser the hosted files as-it-is. These websites are the easiest to set up and great for first-time sites.
Dynamic Web Server
On the other hand, a dynamic web server is a static web server with added software – typically an application server and a database. It is “dynamic” as the app server renews the hosted files before sending the content to a browser via the HTTP server.
For example, the app server may fill an HTML template with content taken from a database to produce the last web pages shown in the browser. Sites like Wikipedia or MDN have thousands of web pages.
Usually, these sites comprise just a few HTML templates and a massive database rather than countless static HTML documents. This format makes it easier to keep and deliver content.