How Apache Works


In this article, we show the apache web server works.

Apache is web server software that allows administrators to run their own web servers

Apache is a program that runs under a suitable multitasking operating system. The underlying operating systems can be of a Unix, Windows, or MacOs variant.

The Apache binary is called httpd under Unix and apache.exe under Windows. It normally runs in the background. Each copy of httpd/apache that is started has its attention directed at a web site, which is, for our purposes, a directory.

Regardless of the operating system used, a site directory typically contains 4 subdirectories.

These are the various subdirectories shown below.

  • conf- Contains the configuration file(s), of which httpd.conf is the most important. It is referred to as the Config file. It specifies the URLs that will be served.
  • htdocs- Contains the HTML files to be served up to the site's clients. This directory and those below it, the web space, are accessible to anyone on the Web and therefore pose a security risk if used for anything other than public data.
  • logs- Contains the log data, both of accesses and errors
  • cgi-bin- Contains the CGI scripts. These are programs or shell scripts written by or for the webmaster that can be executed by Apache on behalf of its clients. It is most important, for security reasons, that this directory not be in the web space- that is, in .../htdocs or below.

In its idling state Apache does nothing but listen to the IP addresses specified in its Config file. When a request appears, Apache receives it and analyzes the headers. It then applies the rules it finds in the Config file and takes the appropriate action.

The webmaster's main control over Apache is through the Config file. The webmaster has some 200 directives at his disposal. These directives give instructions on how the Apache web server should operate.

Related Resources

How to Randomly Select From or Shuffle a List in Python

HTML Comment Box is loading comments...