What is a web server? - Learn web development | MDN (2024)

In this article, we explain what web servers are, how web servers work, and why they are important.

Prerequisites: You should already know how the Internet works, and understand the difference between a web page, a website, a webserver, and a search engine.
Objective: You will learn what a web server is and gain a general understanding of how it works.

Summary

The term web server can refer to hardware or software, or both of them working together.

  1. On the hardware side, a web server is a computer that stores web server software and a website's component files (for example, HTML documents, images, CSS stylesheets, and JavaScript files). A web server connects to the Internet and supports physical data interchange with other devices connected to the web.
  2. On the software side, a web server includes several parts that control how web users access hosted files. At a minimum, this is an HTTP server. An HTTP server is software that understands URLs (web addresses) and HTTP (the protocol your browser uses to view webpages). An HTTP server can be accessed through the domain names of the websites it stores, and it delivers the content of these hosted websites to the end user's device.

At the most basic level, whenever a browser needs a file that is hosted on a web server, the browser requests the file via HTTP. When the request reaches the correct (hardware) web server, the (software) HTTP server accepts the request, finds the requested document, and sends it back to the browser, also through HTTP. (If the server doesn't find the requested document, it returns a 404 response instead.)

What is a web server? - Learn web development | MDN (1)

To publish a website, you need either a static or a dynamic web server.

A static web server, or stack, consists of a computer (hardware) with an HTTP server (software). We call it "static" because the server sends its hosted files as-is to your browser.

A dynamic web server consists of a static web server plus extra software, most commonly an application server and a database. We call it "dynamic" because the application server updates the hosted files before sending content to your browser via the HTTP server.

For example, to produce the final webpages you see in the browser, the application server might fill an HTML template with content from a database. Sites like MDN or Wikipedia have thousands of webpages. Typically, these kinds of sites are composed of only a few HTML templates and a giant database, rather than thousands of static HTML documents. This setup makes it easier to maintain and deliver the content.

Deeper dive

To review: to fetch a webpage, your browser sends a request to the web server, which searches for the requested file in its own storage space. Upon finding the file, the server reads it, processes it as needed, and sends it to the browser. Let's look at those steps in more detail.

Hosting files

First, a web server has to store the website's files, namely all HTML documents and their related assets, including images, CSS stylesheets, JavaScript files, fonts, and video.

Technically, you could host all those files on your own computer, but it's far more convenient to store files all on a dedicated web server because:

  • A dedicated web server is typically more available (up and running).
  • Excluding downtime and system troubles, a dedicated web server is always connected to the Internet.
  • A dedicated web server can have the same IP address all the time. This is known as a dedicated IP address. (Not all ISPs provide a fixed IP address for home lines.)
  • A dedicated web server is typically maintained by a third party.

For all these reasons, finding a good hosting provider is a key part of building your website. Examine the various services companies offer. Choose one that fits your needs and budget. (Services range from free to thousands of dollars per month.) You can find more details in this article.

Once you have web hosting service, you must upload your files to your web server.

Communicating through HTTP

Second, a web server provides support for HTTP (Hypertext Transfer Protocol). As its name implies, HTTP specifies how to transfer hypertext (linked web documents) between two computers.

A Protocol is a set of rules for communication between two computers. HTTP is a textual, stateless protocol.

Textual

All commands are plain-text and human-readable.

Stateless

Neither the server nor the client remember previous communications. For example, relying on HTTP alone, a server can't remember a password you typed or remember your progress on an incomplete transaction. You need an application server for tasks like that. (We'll cover that sort of technology in other articles.)

HTTP provides clear rules for how a client and server communicate. We'll cover HTTP itself in a technical article later. For now, just be aware of these things:

  • Usually only clients make HTTP requests, and only to servers. Servers respond to a client's HTTP request. A server can also populate data into a client cache, in advance of it being requested, through a mechanism called server push.
  • When requesting a file via HTTP, clients must provide the file's URL.
  • The web server must answer every HTTP request, at least with an error message.

On a web server, the HTTP server is responsible for processing and answering incoming requests.

  1. Upon receiving a request, an HTTP server checks if the requested URL matches an existing file.
  2. If so, the web server sends the file content back to the browser. If not, the server will check if it should generate a file dynamically for the request (see Static vs. dynamic content).
  3. If neither of these options are possible, the web server returns an error message to the browser, most commonly 404 Not Found. The 404 error is so common that some web designers devote considerable time and effort to designing 404 error pages. What is a web server? - Learn web development | MDN (2)

Static vs. dynamic content

Roughly speaking, a server can serve either static or dynamic content. Remember that the term static means "served as-is". Static websites are the easiest to set up, so we suggest you make your first site a static site.

The term dynamic means that the server processes the content or even generates it on the fly from a database. This approach provides more flexibility, but the technical stack is more complex, making it dramatically more challenging to build a website.

It is impossible to suggest a single off-the-shelf application server that will be the right solution for every possible use case. Some application servers are designed to host and manage blogs, wikis, or e-commerce solutions, while others are more generic. If you're building a dynamic website, take the time to research your requirements and find the technology that best fits your needs.

Most website developers won't need to create an application server from scratch, because there are so many off-the-shelf solutions, many of which are highly configurable. But if you do need to create your own server, then you will probably want to use a server framework, leveraging its existing code and libraries, and extending just the parts that you need in order to meet your use case. Only a relatively small number of developers should need to develop a server completely from scratch: for example, in order to meet tight resource constraints on an embedded system. If you'd like to experiment with building a server, take a look through the resources in the Server-side website programming learning pathway.

Next steps

Now that you are familiar with web servers, you could:

  • read up on how much it costs to do something on the web
  • learn more about various software you need to create a website
  • move on to something practical like how to upload files on a web server.
What is a web server? - Learn web development | MDN (2024)

FAQs

What is a web server? - Learn web development | MDN? ›

A web server connects to the Internet and supports physical data interchange with other devices connected to the web. On the software side, a web server includes several parts that control how web users access hosted files. At a minimum, this is an HTTP server.

What is web server in web development? ›

A web server is software and hardware that uses HTTP (Hypertext Transfer Protocol) and other protocols to respond to client requests made over the World Wide Web. The main job of a web server is to display website content through storing, processing and delivering webpages to users.

What is the difference between a web server and a website? ›

A web server is a computer hosting one or more websites. "Hosting" means that all the web pages and their supporting files are available on that computer. The web server will send any web page from the website it is hosting to any user's browser, per user request.

What is the programming on a web server called? ›

Most of the code to support a dynamic website must run on the server. Creating this code is known as "server-side programming" (or sometimes "back-end scripting").

What is a web server course? ›

Understanding web servers can provide you with the skills and knowledge to design, deploy, and manage the servers efficiently. Advance your career by learning about web servers with courses delivered through edX.

What is a web server for dummies? ›

A web server connects to the Internet and supports physical data interchange with other devices connected to the web. On the software side, a web server includes several parts that control how web users access hosted files. At a minimum, this is an HTTP server.

Can a website run without a server? ›

Serverless Architecture: With serverless architecture, websites are built using serverless functions or APIs. This approach eliminates the need for managing servers, resulting in cost savings, scalability, and easier deployment.

Is a web server a web browser? ›

A web browser is a software program that shows a web page. It normally connects to the internet to access the document. A web server is a computer or software that provides services to other applications known as clients. The web browser requests online pages and services from the server.

Is a web server a domain? ›

A domain is just shorthand for an IP address that correlates to your web server. An IP address is really what is TIED with your web server. If 1.1. 1.1 is the ip address your web server is correlated to, THEN these requests will both get sent to your web server.

Is Google a web server? ›

No, Google is a company and not a web server, but it operates numerous web servers to deliver a larger number of services such as their search engine, Gmail, Docs, etc. Their servers handle large volumes of user requests, process data, and provide responses.

Is Python a web server? ›

A Python web server is a software system designed to process web requests using the HTTP or HTTPS protocols and deliver web content to clients.

Which code can create a web server? ›

js is a popular choice for writing back-end code. In this tutorial, you will learn how to build web servers using the http module that's included in Node. js. You will build web servers that can return JSON data, CSV files, and HTML web pages.

What is a web server in simple words? ›

A web server is a computer system combined with software used for the storing and serving of website files. Every time a user goes to a website, their client – a browser – requests the web page's contents from the web server. In turn, the web site server delivers this to the user's client.

What is the difference between web and web server? ›

A web browser acts as a link/ interface between a client and a server. Its primary function is to display various web documents to the clients requesting them. A web server functions to accept browser requests, generate responses, maintain the web apps, and accept the client data.

What is the job of a web server? ›

Web servers are primarily used to process and manage HTTP/HTTPS requests and responses from the client system. A web server can also perform several other functions, such as: Store and protect website data: A web server can store and protect critical website data from unauthorized users.

What is a web server and a web client? ›

The basic objective of the web server is to store, process and deliver web pages to the users. Web browser is an example of a web client. Web servers speak the HTTP protocol, so they are often called HTTP servers. These HTTP servers store the Internet's data and provide the data when it is requested by HTTP clients.

What is web server vs web application? ›

A web server is a software component that delivers static data like images, files, and text in response to client requests. An application server adds business logic to compute the web server's response.

What is web server and API? ›

A server is a computer where you host your program. An API is a type of program used to receive / send data. Image you build a website with a login form.

Top Articles
Ripple (XRP), the SEC and crypto news
Warning: Co-Signing Can affect Your Credit! | Every Buck Counts
Antisis City/Antisis City Gym
Cold Air Intake - High-flow, Roto-mold Tube - TOYOTA TACOMA V6-4.0
Western Union Mexico Rate
Autobell Car Wash Hickory Reviews
Mohawkind Docagent
How to Watch Braves vs. Dodgers: TV Channel & Live Stream - September 15
1TamilMV.prof: Exploring the latest in Tamil entertainment - Ninewall
Nestle Paystub
Clairememory Scam
FIX: Spacebar, Enter, or Backspace Not Working
Caroline Cps.powerschool.com
Crusader Kings 3 Workshop
4302024447
Reddit Wisconsin Badgers Leaked
Guidewheel lands $9M Series A-1 for SaaS that boosts manufacturing and trims carbon emissions | TechCrunch
Dexter Gomovies
Chic Lash Boutique Highland Village
Nba Rotogrinders Starting Lineups
Pac Man Deviantart
Les Rainwater Auto Sales
Why Is 365 Market Troy Mi On My Bank Statement
Drago Funeral Home & Cremation Services Obituaries
Myhr North Memorial
Speedstepper
Craigslist Rome Ny
Jailfunds Send Message
Movies - EPIC Theatres
The Procurement Acronyms And Abbreviations That You Need To Know Short Forms Used In Procurement
Kamzz Llc
Mbi Auto Discount Code
Blackstone Launchpad Ucf
Craigslist Albany Ny Garage Sales
ENDOCRINOLOGY-PSR in Lewes, DE for Beebe Healthcare
Barber Gym Quantico Hours
Housing Intranet Unt
Nsav Investorshub
Metro Pcs Forest City Iowa
18006548818
Craigslist Minneapolis Com
Ups Customer Center Locations
Argus Leader Obits Today
Joy Taylor Nip Slip
Craigslist Sarasota Free Stuff
라이키 유출
Aspen.sprout Forum
4015 Ballinger Rd Martinsville In 46151
Haunted Mansion Showtimes Near The Grand 14 - Ambassador
Latest Posts
Article information

Author: Neely Ledner

Last Updated:

Views: 6543

Rating: 4.1 / 5 (62 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Neely Ledner

Birthday: 1998-06-09

Address: 443 Barrows Terrace, New Jodyberg, CO 57462-5329

Phone: +2433516856029

Job: Central Legal Facilitator

Hobby: Backpacking, Jogging, Magic, Driving, Macrame, Embroidery, Foraging

Introduction: My name is Neely Ledner, I am a bright, determined, beautiful, adventurous, adventurous, spotless, calm person who loves writing and wants to share my knowledge and understanding with you.