Apache is the most widely used web server software. Developed and maintained by Apache Software Foundation, Apache is an open source software available for free to use. More than 60% of people used this web server in the world. It is fast, reliable, and secure. It is very useful in terms of the compatibility with different environments by using the extensions and modules. Most of the hosting providers use Apache as their web server software. However, we can use other web server software as well to run the server.
About the Apache Server
A web server is like a restaurant host. When you arrive in a restaurant, the host greets you, checks your booking information and takes you to your table. Similar to the restaurant host, the web server checks for the web page you have requested and fetches it for your viewing pleasure. However, A web server is not just your host but also your server. Once it has found the web page you requested, it also serves you the web page. A web server like Apache is also the Master of the restaurant. It handles your communications with the website (the kitchen), handles your requests, makes sure that other staff (modules) are ready to serve you. It is also the sweeper, as it cleans the tables (memory, cache, modules) and clears them for new customers.
So basically a web server is the software that receives your request to access a web page and provides the response for the same. It runs a few security checks on your HTTP request and takes you to the web page. Depending on the page you have requested, the page may ask the server to run a few extra modules while generating the document to serve you. It then serves you the document you requested. Pretty awesome isn’t it.
Working of the Apache Server
The Apache server is set up to run through configuration files, in which directives are added to control its behavior. In its idle state, Apache listens to the IP addresses identified in its config file (HTTPd.conf). Whenever it receives a request, it analyzes the headers, applies the rules specified for it in the Config file, and takes action.
But one server can host many websites, not just one – though, to the outside world, they seem separate from one another. To achieve this, every one of those websites has to be assigned a different name, even if those all map eventually to the same machine. This is accomplished by using what is known as virtual hosts.
now. Find out More
Since IP addresses are difficult to remember, we, as visitors to specific sites, usually type in their respective domain names into the URL address box on our browsers. The browser then connects to a DNS server, which translates the domain names to their IP addresses. The browser then takes the returned IP address and connects to it. The browser also sends a Host header with the request so that, if the server is hosting multiple sites, it will know which one to serve back.
For example, typing in www.google.com into your browser’s address field might send the following request to the server at that IP address:
GET / HTTP/1.1 Host: www.google.com
The first line contains several pieces of information. First, there is the method (in this case it’s a GET), the URI, which specifies which page to be retrieved or which program to be run (in this case it’s the root directory denoted by the /), and finally there is the HTTP version (which in this case is HTTP 1.1). HTTP is a request / response stateless protocol
HTTP is a request / response stateless protocol. It’s a set of rules that govern communication between a client and the server. The client (usually but not necessarily a web browser) makes a request, the server sends back a response, and communication stops. The server doesn’t look forward to more communication as is the case with other protocols that stay at a waiting state after the request is over.
If the request is successful, the server returns a 200 status code (which means that the page is found), response headers, along with the requested data. The response header of an Apache server might look something like the following:
HTTP/1.1 200 OK Date: Tues, 23 Oct 2018 15:19:21 GMT Server: Apache Cache-Control: no-cache, must-revalidate, max-age=0 Pragma: no-cache Last-Modified: Tues, 23 Oct 2018 15:18:45 GMT Vary: Accept-Encoding,User-Agent Content-Type: text/html; charset=UTF-8 Content-Length: 9580
The first line in the response header is the status line. It contains the HTTP version and the status code. The date follows next, and then some information about the host server and the retrieved data. The header
Content-Type lets the client know the type of data retrieved so it knows how to handle it.
Content-Length lets the client know the size of the response body. If the request didn’t go throw, the client would get an error code and message, such as the following response header in case of a page not found error:
HTTP/1.1 404 Not Found
Versions of the Apache Server
Version 1.1: The Apache License 1.1 was approved by the ASF in 2000: The primary change from the 1.0 license is in the ‘advertising clause’ (section 3 of the 1.0 license); derived products are no longer required to include attribution in their advertising materials, only in their documentation.
Version 2.0: The ASF adopted the Apache License 2.0 in January 2004. The stated goals of the license included making the license easier for non-ASF projects to use, improving compatibility with GPL-based software, allowing the license to be included by reference instead of listed in every file, clarifying the license on contributions, and requiring a patent license on contributions that necessarily infringe a contributor’s own patents.