Web server can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver web content that can be accessed through the Internet.
The most common use of web servers is to host websites, but there are other uses such as gaming, data storage or running enterprise applications.
The primary function of a web server is to deliver web pages on the request to clients using the Hypertext Transfer Protocol (HTTP). This means delivery of HTML documents and any additional content that may be included by a document, such as images, style sheets and scripts.
A user agent, commonly a web browser or web crawler, initiates communication by making a request for a specific resource using HTTP and the server responds with the content of that resource or an error message if it is unable to do so. The resource is typically a real file on the server's secondary memory.
While the primary function is to serve content, a full implementation of HTTP also includes ways of receiving content from clients. This feature is used for submitting web forms, including uploading of files.
Many generic web servers also support server-side scripting using Active Server Pages (ASP), PHP, or other scripting languages. This means that the behavior of the web server can be scripted in separate files, while the actual server software remains unchanged. Usually, this function is used to create HTML documents dynamically as opposed to returning static documents. The former is primarily used for retrieving and/or modifying information from databases. The latter is typically much faster and more easily cached.
Apart from serving the World Wide Web, They can also found embedded in devices such as printers, routers, webcams and serving only a local network. The web server may then be used as a part of a system for monitoring and/or administering the device in question. This usually means that no additional software has to be installed on the client computer; since only a web browser is required (which now is included with most operating systems).
Web servers are able to map the path component of a Uniform Resource Locator (URL) into:
- A local file system resource (for static requests)
- An internal or external program name (for dynamic requests)
For a static request the URL path specified by the client is relative to the web server's root directory.
The web server then reads the file, if it exists and sends a response to the client's Web browser. The response will describe the content of the file and contain the file itself or an error message will return saying that the file does not exist or is unavailable.
Web server has 2 modes Kernel mode and User mode i.e. A web server can be either implemented into the OS kernel, or in user space.
Features of web servers
- Virtual hosting to serve many Web sites using one IP address
- Large file support to be able to serve files whose size is greater than 2 GB on 32 bit OS
- Bandwidth throttling to limit the speed of responses in order to not saturate the network and to be able to serve more clients
- Server-side scripting to generate dynamic Web pages, still keeping web server and website implementations separate from each other