How do Web Servers work?
Priyanka Shyam
Network Geek with a robust skill set | CCDE (Written) | CCIE | CWNA | Cisco SCOR | Cisco SD-WAN Expert | Technical Writer | Multitasker | Considerate & Empathic Communicator
The Internet acts as a source of plethora of information to us and all we need to do, if we want any information is to just query the internet and then we will get the desired response.But who provides this information to us and how? All this is facilitated by what is called as the Web Server.Along with the it there are browsers as applications which we use such as Internet Explorer, Mozilla Firefox, Chrome, Safari etc to interact with the web and browse & retrieve the files on web server known as Web Clients.
Whenever we try to access any website then simple process consists of 4 steps, they are:
Obtaining the IP Address from domain name: Our web browser first obtains the IP address the domain name (for e.g., for this page the domain name is www.dhirubhai.net) resolves to. It can obtain the IP address in 2 ways-
- By searching in its cache.
- By requesting one or more DNS (Domain Name System) Servers.
Note: Any website is assigned an IP address when it is first created on web server.
Browser requests the full URL : After knowing the IP Address, the browser now demands a full URL from the web server.
Web server responds to request: The web server responds to the browser by sending the desired pages, and in case, the pages do not exist or some other error occurs, it will send the appropriate error message.
For example:You may have seen Error 404, while trying to open a webpage, which is the message sent by the server when the page does not exist.
Another common one is Error 401 when access is denied to us due to incorrect credentials, like username or password, provided by us.
Browser displays the web page: The Browser finally gets the webpages and displays it, or displays the error message.
What are Web Servers?
Web Servers are basically simple computer programs that dispense the web page when they are requested using the web client. The machines on which this program run are usually called as a server, with both the names web server and server almost used interchangeably.
Or
Web server is a computer where the web content is stored. Basically web server is used to host the web sites but there exists other web servers also such as gaming, storage, FTP, email etc.Web site is collection of web pages while web server is a software that respond to the request for web resources.
Or
Web Servers are the computers that are usually set up in facilities in Data Centers and operated by hosting companies. The purpose of these computers is to store the websites so that people can visit them on the internet.The files stored on the web servers are read by the browsers such as Firefox, Safari, chrome and IE which convert these files into images and then text for you to view.
Your browser communicates with the web server to bring you information from the internet. Web servers communicate with many browsers on many computers all at the same time . Their purpose is to serve the files as requested. A server can send the same file or different files to hundred of users at the same time.
Many factors go ingot determining that how many files a web server can handle at once. Server hardware plays a role in this when comparing how fast the servers processor speed is and to how popular the site is and how many views it has at once. Provider spider has multiple server options to fit in every need.
Web Server Software what it is?
Web Server typically run two types of the OS Linux or Microsoft Windows. Most web servers today operate linux and most websites are hosted on the Linux Servers.Servers with Linux and Microsoft windows installed on them also run other key software programs similar to your home computer . These software program is called Daemons , and they run in the background rather than in the direct control of the user or person viewing websites files on the internet .
Confusingly, enough these software programs are also referred to as servers themselves. So you must distinguish if Servers means hardware or the software that run on them, based on the context. For example here are some daemons software which runs on all the Web Servers.
Http Server: Send websites files.
FTP Server : allows for uploading the files
Email Server : Gather and directs email
Database Server : Stores information defined in the fields, essential to the operation of the website itself. For example an eCommerce site needs to keep track of names , addresses and product information.
Web Servers also run other software programs which are installed on them . These programs too run in the background but are accessed with the username and password to protect them. Such programs can be very useful and helpful in creating the websites.
For example : Wordpress, zencart
Web Server Working
Web server respond to the client request in either of the following two ways:
- Sending the file to the client associated with the requested URL.
- Generating response by invoking a script and communicating with database
Key Points
- When client sends request for a web page, the web server search for the requested page if requested page is found then it will send it to client with an HTTP response.
- If the requested web page is not found, web server will the send an HTTP response:Error 404 Not found.
- If client has requested for some other resources then the web server will contact to the application server and data store to construct the HTTP response.
How do web servers work?
What happens when you enter in the address field of your browser the URL https://www.akamai.com/doc/sample.html?
First, the browser slices the URL in 3 parts:
- https://: This part indicates that the document you want to access can be retrieved from web server, which understands the HTTP protocol. The HTTP protocol is a standardized language of communication between browsers and web servers.
- www.akamai.com: This is the host name of the computer from which the document can be downloaded.
- /doc/sample.html: This is the virtual path of the document in the www.akamai.com's web server.
Then, the browser contacts a DNS (Domain Name Server) to know the IP address of the computer which full qualified domain name is www.akamai.com. The domain name server is usually run by your ISP or by your company.
The browser establishes a connection channel with the web server on the computer which IP address was given by the DNS server and requests the document on the host which name is www.akamai.com and which virtual path is doc/sample.html. The browser has to specify in the request the host name because many modern web servers (including Abyss Web Server) have the ability to serve more than a one host from a single computer with a single IP address only. This is called virtual hosting. In such a case, the IP address of this computer is associated with more than one domain name.
The server decodes the request and maps the virtual path to a real one, which should match an existing file. The server sends the file to the browser with some useful information such as its last modification time and its MIME type. The MIME type helps the browser decide how to display the received document. In our example, it is a HTML file. So the server sets its MIME type to text/html and the browser understands that it must render it as text.
Sometimes you enter a URL without an explicit filename such
as https://www.akamai.com/doc. The browser sends the request to the web server as in the previous example. The server detects that the virtual path maps to a directory and not to a file. It searches then in this directory an index file. Index files are usually named index.html or index.htm. If it finds for example index.html, it acts as if the requested URL washttps://www.aprelium.com/doc/index.html. If no index file is found, the web server generates a listing of the directory contents and sends it to the browser or reports an error.
Architecture
Web Server Architecture follows the following two approaches:
- Concurrent Approach
- Single-Process-Event-Driven Approach.
Concurrent Approach
Concurrent approach allows the web server to handle multiple client requests at the same time. It can be achieved by following methods:
- Multi-process
- Multi-threaded
- Hybrid method.
Multi-processing
In this a single process (parent process) initiates several single-threaded child processes and distribute incoming requests to these child processes. Each of the child processes are responsible for handling single request.
It is the responsibility of parent process to monitor the load and decide if processes should be killed or forked.
Multi-threaded
Unlike Multi-process, it creates multiple single-threaded process.
Hybrid
It is combination of above two approaches. In this approach multiple process are created and each process initiates multiple threads. Each of the threads handles one connection. Using multiple threads in single process results in less load on system resources.
Examples
Following table describes the most leading web servers available today:
Apache HTTP Server
This is the most popular web server in the world developed by the Apache Software Foundation. Apache web server is an open source software and can be installed on almost all operating systems including Linux, UNIX, Windows, FreeBSD, Mac OS X and more. About 60% of the web server machines run the Apache Web Server.
Internet Information Services (IIS)
The Internet Information Server (IIS) is a high performance Web Server from Microsoft. This web server runs on Windows NT/2000 and 2003 platforms (and may be on upcoming new Windows version also). IIS comes bundled with Windows NT/2000 and 2003; Because IIS is tightly integrated with the operating system so it is relatively easy to administer it.
Summarizing it all, web servers can be used by an individual or by web hosting provider companies. In case an individual does so, he will be locally hosting the website only on his own system (i.e., the contents of the website can be accessed only on the local system and not on any other system), whereas when hosting provider companies hosts them, the website can be viewed by anyone across the globe. An individual can also host his website publicly with his web server, but for that one must have leased line internet connection (to get a dedicated IP address) and a DNS server to connect it with the domain of website (generally not preferred due to security reasons).
KeyPoint
Servlet : Servlet is an interface that must be implemented for creating any Servlet. Servlet is a class that extends the capabilities of the servers and responds to the incoming requests. It can respond to any requests. Servlet is a web component that is deployed on the server to create a dynamic web page.For example : A Java servlet is a Java software component that extends the capabilities of a server. Although servlets can respond to many types of requests, they most commonly implement web containers for hosting web applications on web servers and thus qualify as a server-side servlet web API.
Student at jordan unvesity college morogoro
9 个月so the database operator can seen all the activity which client are done or conduct