What is a web server?

Hi,

I am taking a course on how to build a simple web app using Flask and Python.
I have stumbled upon the term “web server”.

MDN states that web server is a computer hosting one or more website. However, in lecture 3 (Flask) of the EdX CS50: Web Programming with Python and Javascript course, at 41:37, the instructor mentioned that the Flask class was imported from the flask module to create a flask web server.

This is pretty confusing and I would like to know what is it actually a web server. Is a web server referring to a computer hosting websites or is it referring to the flask web-app itself which is responsible to deal with the HTTP requests and response?

Link to MDN and EdX CS50:

  1. https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Pages_sites_servers_and_search_engines

  2. https://courses.edx.org/courses/course-v1:HarvardX+CS50W+Web/courseware/3b4d945d89eb40bcad81746770a81c3b/c62f675bf7f94f0e91b408cacda56451/1?activate_block_id=block-v1%3AHarvardX%2BCS50W%2BWeb%2Btype%40html%2Bblock%408710d2ee304441a788fefa22112ec675

Thanks.

Hey @JY93 I can’t access the course, but I think there is a spelling error or just something said that is not 100% percent correct.

Flask, like Django, Ruby on Rails, etc. are webframeworks that enables programmers to use Programming languages like Python or Ruby to make interactive webpages aka webapps.
But you need a webserver to serve your website to the world and take the input from the users. You definitively could make a webserver with Python if you want, maybe where are some, but Flask is something that needs a webserver. Flask and Django have a built-in Server for development purposes. But that development-server is not Flask, it’s just a helper tool.

I drew a little diagram to help you understand the connections between the different parts that are involved when you view a website:

  1. The most underlying thing is the hardware, a powerful computer called server.
  2. This server is operated by the operating system, called OS. For web servers this is mostly a Linux (Like Debian, Ubuntu, etc.).
  3. The OS runs a programming language like Python or Ruby. With that you can make the OS do some things.
  4. The programming language then runs a software called web framework like Flask or Django. The Framework is used to make a interactive web page. It will generate HTML pages, call and write data to a database, etc.
  5. Also installed in the OS is another software called web server (Apache, NGINX). This software is used to serve the content of the web framework to the world (internet).
  6. The internet transports your website from the web server to the user.
  7. The user requests the site, reads it and give it some data. This data is served back over the internet to the web server and from there to the web framework.

Note: You can make a so called static web-page with HTML and CSS only. This site doesn’t need a web framework. It just needs a Webserver to server the files to the internet. But this site is not able to get input from a user, it is read only.

I hate to say this but that is a very advanced topic for a beginner. Is this your first programming class? Did you pay money for this? How far into the course does this exercise show up?

I ask because, there’s no way writing a web server should be considered a beginner topic, and if you paid money for the course you should request a refund.

But, tell me more.

1 Like

I also got more information from https://netgears.support/netgear-genie-support about the web server and also about networking.

No disrespect intended @JY93 but that course you highlighted is aimed at Intermediates. If you are unfamiliar with the function and purpose of a ‘web server’, I’d take a beginner course first.