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.
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.
Generally, many people, when they think of web servers, they think of them being some high-powered computers, while this is correct to some extent, as some high-powered computers are also called as web servers, but these computers are built with the purpose of web hosting . In web hosting, the web servers enable the hosting providers to handle multiple domains (or multiple websites) on a single server. But, normally, when someone refers to a web server, it means the piece of software that can be downloaded on the computer system.
When is web server required?
Generally, web servers are used by web hosting companies and professional web app developers. But, actually anyone who satisfies one of the below category can use it-
- One who owns a website (to make the local copy on their system resemble what is on internet).
- One who wants to use server-side technologies, such as, PHP or ColdFusion, can also use the web server.
How Web servers work?
A page on internet can be viewed, when the browser requests it from the web server and the web server responds with that page. A simple diagrammatic representation of this is as given below in the figure:
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.geeksforgeeks.org) 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.
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.
Popular Web Servers
There are quite a few web servers available, like, Apache, Microsoft IIS, Nginx Web Server, LightSpeed Web Server. But, the two most popular ones are-
- Apache HTTP Server:It is the most popular web server available and is widely used. It is developed and maintained by Apache Software Foundation. The Software is produced under the Apache Licence, which makes it free and open source.
It is available for a variety of operating Systems- Windows, Mac OS X, Unix, Linux, Solaris, Novell Netware and FreeBSD.
- Microsoft Internet Information Service: Microsoft IIS (Internet Information Service) is the second most popularly used web server, and its market share is increasing quite rapidly with each passing day and is likely to overhaul Apache in the upcoming years.
IIS server has all the features just like Apache, but it is not open source. It is developed, and maintained by Microsoft, thus it works with all the Windows operating system platforms.
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).
This article is contributed by Mrigendra Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Computer Network | Servers
- Load Balancing on Servers (Randomized Algorithm)
- How does a vector work in C++?
- How Does the Blockchain Work?
- How Do Search Engines Work?
- How do Dynamic arrays work?
- How does Duff's Device work?
- Placements | QA | Work and Wages
- Does overloading work with Inheritance?
- Puzzle | ( Distance, Time and Work)
- QA - Placement Quizzes | Work and Wages | Question 10
- QA - Placement Quizzes | Work and Wages | Question 1
- QA - Placement Quizzes | Work and Wages | Question 13
- QA - Placement Quizzes | Work and Wages | Question 12
- QA - Placement Quizzes | Work and Wages | Question 14