A web server is a software which runs inside the server and helps us to host websites. Some of the famous web servers are Apache, IIS (Internet information server) and Sun java system web server. Following are the functions of web server:-
- Function 1:- The first important function of web server is to host our website on the internet and deliver our web pages to end users. Web server delivers content to end user browsers using HTTP protocol and it can also deliver in various formats like HTML, XML etc.
- Client sends a request to the webserver. The request can be for getting a page or sending some data.
- Web server receives the request and gets the web page as per request.
- This page is then sent as HTML response to the browser.
- Function 2:- Web server helps you run server side languages like JSP, ASP.NET , PHP etc. Server side languages are needed to connect to the database, do validation etc. Web server helps to run these server side language pages.
- Function 3:- Web server also helps to implement security for web pages. For example you can use SSL (secured sockets layer) with webserver and ensure that all communication between client and server happens in an encrypted manner. For example below is a simple figure which shows without SSL how the data is not encrypted when browser and web server communicate but the time we put SSL everything is communicated in an encrypted manner which leads to more security. SSL sites are surfed with “https” while non-ssl sites are surfed with only “http” i.e without a “S”.
- Function 4:- The other important function of web server is to ensure stability in websites. Inside one webserver we can host multiple website. But of one website goes down due to some reason the other website should work properly. Below is a simple image snapshot which shows two websites hosted “WebSite1” and “WebSite2” inside IIS (Internet information server). IIS is a webserver created by Microsoft. Now if some problem happens with “Website1”, “WebSite2” still keeps running. This happens because web server provides isolation between websites hosted.