Web servers respond to Hypertext Transfer Protocol (HTTP) requests from clients and send back a response containing a status code and often content such as HTML, XML or JSON as well.
Web servers are the ying to the web client's yang. The server and client speak the standardized language of the World Wide Web. This standard language is why an old Mozilla Netscape browser can still talk to a modern Apache or Nginx web server, even if it cannot properly render the page design like a modern web browser can.
The basic language of the Web with the request and response cycle from client to server then server back to client remains the same as it was when the Web was invented by Tim Berners-Lee at CERN in 1989. Modern browsers and web servers have simply extended the language of the Web to incorporate new standards.
The conceptual web server idea can be implemented in various ways. The following web server implementations each have varying features, extensions and configurations.
The Apache HTTP Server has been the most commonly deployed web server on the Internet for 20+ years.
Caddy is a newcomer to the web server scene and is focused on serving the HTTP/2 protocol with HTTPS.
rwasa is a newer web server written in Assembly with no external dependencies that tuned to be faster than Nginx. The benchmarks are worth taking a look at to see if this server could fit your needs if you need the fastest performance trading off for as of yet untested web server.
A client that sends a request to a web server is usually a browser such as Internet Explorer, Firefox, or Chrome, but it can also be a
Web servers process requests from the above clients. The result of the web server's processing is a response code and commonly a content response. Some status codes, such as 204 (No content) and 403 (Forbidden), do not have content responses.
A web server sends files to a web browser based on the web browser's request. In the first request, the browser accessed the "www.fullstackpython.com" address and the server responded with the index.html HTML-formatted file. That HTML file contained references to other files, such as style.css and script.js that the browser then requested from the server.
A Simple Web Server in less than 500 lines of code from the Architecture of Open Source book provides a great example with Python as the implementation language..
Building a basic HTTP Server from scratch in Python (source code builds a very simple but insecure web server to show you how HTTP works.
A reference with the full list of HTTP status codes is provided by W3C.
Apache vs Nginx: practical considerations gives an an overview of each project, explains how each one handles connections, how it is configured and the differences between the two web servers in how it can use custom modules.
Optimizing web servers for high throughput and low latency is a wonderful read that shows how detailed knowledge at every layer of the stack is necessary to optimize web server connections at scale.
Implementing a tiny web server in a single printf call is an absurd C language hack that you would never want to use in any real project but still an amazing little application and wonderful explanation that you can learn a bit more about web servers by reading.
Create an SSL certificate via Let's Encrypt. You will need SSL for serving HTTPS traffic and preventing myriad security issues that occur with unencrypted user input.
Once you set up the WSGI server you'll need to configure the web server as a pass through for dynamic content.