Exactly what does the apache server do whenever a client visits an internet site that is located onto it. i.e what folder will it access and what's the default page it attempts to serve? What's the folder structure it consists of. Will it maps the folders?

What links can answer this type of type of questions. I've looked world wide web.apache.org but the majority of the paperwork say how you can install start and so on, I've experience of socket programming as well as in general programming. Do you know the number of steps apache takes whenever a client connects to the port number 80.

Essentially apache can function as "one domain" server or multiple (virtualhost) hosting server.

Talking about apache 2, server virtual hosts are set up in

path_to_apache_config/sites-available/domain_config

path_to_apache_config/sites-enabled/link_to_domain_config

In each meaning of virtual host, that could be just your personal local host, you will find lots of configurations which may be applied and alter behavior for every site you're hosting.

Whenever a client connects to some server, apache inspections whether there's a definition that suits domain in user request. In the event that's positive, it read's the configuration which points towards the website files folder with directive

DocumentRoot /var/world wide web/your_site_folder

From that part you're free of charge any folder structure you would like. If you are using mod_userdir, which allows to host web pages for customers who are recognized to the machine, it'll point these to

/home/john/public_html

And in the future, it is equivalent to pointed out above.

What pages the server can serve is dependent on installed libraries. Default configurations are that apache servers html pages. Should you install php, cgi (executables) support, you are able to server other appropriate pages.

The very first factor server searches for is really a - index.(htmlphp...). If it doesn't exist, it attempts to list this content of this directory (is dependent only on configuration whether it's permitted), otherwise it returns "Forbidden..." status.