Let’s us understand about the mechanisms that delivered the content / page on the internet.

User are sitting at a computer right now, viewing this page in a browser.  When you clicked link or typed the URL (uniform resource locator) then what happened behind the screen.

In this article, i will explain the mechanism & how Web servers bring pages into your browser!

 

In short the mechanism behind this process is a program knows as Web Server and it’s a program required to serve the pages to the users through HTTP (Hypertext Transfer Protocol) . 

If you want to get into a bit more detail on the process of getting a Web page onto your browser screen, here are the some basic steps that occurred behind the scenes:

 

If you type the URL – http://riiteshbhachawat.com/home then then browser will break the URL in to three different parts:-

 

Server name (“www.riiteshbhachawat.com”) – Browser translates the server name to IP address to connect with the server.

HTTP protocol ("http") – Browser sends the GET request to the server for home.htm file.

The page / file name ("home") – Web Server serves the file from his document root.

 

Apache Web Server is most widely used web server and approximately it serves about 60 % of web sites today. It’s completely open source server developed by Open Source Community and initially it was based on the NCSA HTTPd server. Some of the basic features of the Apache Web Server are below:-

1)      Free & based on Open Source.

2)      Configuration files are simple text files.

3)      Modular & Cross platform multi-purpose server.

4)      Capable of handling multiple scripting languages.

5)      Does not Require High End Hardware and highly scalable server.

6)      Provides many capabilities include SSL encryption, Web Publishing & Virtual Hosting.

7)      Integrates with wide variety of application and supports single tiered & clustered architectures.

 

Now let’s start some fun stuff by learning the installation & configuration of the Apache Web Server.

 

Installation: - Here I am mentioning the installation for Windows OS so You should download the Apache Web Server from ApacheLounge.com site.

1)      Download the httpd-2.4.20-win64-VC11.zip from the site and extract it to the machine drive. I have extracted into D Drive          but you can extract in C or any other drive based on your partition For Ex: D:\Apache24 folder.

2)      Open Command Prompt as Administrator and navigate to D:\Apache24\bin directory

3)      Execute httpd.exe -k install and it will install the service in the windows machine and there are 2 ways to start the services         – either by Apache Monitor or through windows service Manager. You will find the Apache 2.4 services in the section and         click Start service. If you are having trouble while starting the services then check your port 80 and it is by default port used         by Apache Web Server.  You can also change the port in the httpd.conf file under conf folder as per the availability of the         port.

4)     After starting the service then check the logs file and if there is no error in the log file then we are good to go forward.

5)      Now let’s test the web server by opening it in the browser, just type localhost in the browser and you will see “It Works”         Message then congrats of setting up the web server.

 

Configurations: -

1)      You can also configure the hosts’ entry by defining your local domain the system hosts file which is under         C:\Windows\System32\drivers\etc.

2)      Now let’s try to serve our custom html pages from the web server so just create the mywebsite folder in your machine drive         which is D:\mywebsite in my case. Create Index.html file inside mywebsite folder.

3)      Stop the apache service and Open httpd.conf file and search for httpd-vhosts.conf file location and then open the          vhosts.conf file and replace virtualhost elements with below :-

<VirtualHost *:80>

    ServerAdmin webmaster@mywebsite.localdomain.com

    DocumentRoot "D:\mywebsite"

    ServerName mywebsite.localdomain

    ServerAlias www.dummy-host.example.com

    ErrorLog "logs\mywebsite.localdomain-error.log"

    CustomLog "logs\mywebsite.localdomain-access.log" common

                <Directory "D:\mywebsite"> 

    Options Indexes FollowSymLinks   

    AllowOverride All

    Require all granted

</Directory>     

</VirtualHost>

4)      Open httpd.conf file and edit the below section :-

        DocumentRoot "D:\mywebsite"

        <Directory "D:\mywebsite">

        ServerRoot "D:\Apache24"

5)      Restart the Apache Service and open the browser by typing the domain you have defined in the hosts file.

 

            Congrats you can see the content from your custom index.html file on the browser.

 In order to improve the performance there are many areas defined in the server and some of them are below:-

  • Unload Unneeded Modules
  • Move Code out of Apache
  • Limit the Number of Apache Processes and Children

 

If you need more detailed information on any item related to Apache Web Server then feel free to send an email to riteshkumarb@yahoo.com