How Does an Apache Web Server Work?

By G.S. Jackson

Apache is a web server application that handles incoming and outgoing HTTP traffic.
i Jupiterimages/Photos.com/Getty Images

The Internet exists as a collection of Web servers that host Web pages that users can access from their computers. These server must run server software to handle user requests. One such software package, the Apache Web server, offers a free server solution for developers to host Web pages from. As such, it has become a popular program for website hosting. The Apache server works by handling URL requests to the server through specific communication protocols in a multithreading fashion, and extending itself to work with programming and database languages.

URLs and HTTP Protocol

Apache is web server software, and as such handles primarily Hypertext Transfer Protocol requests through Universal Resource Locator address requests. URLs are simply the name of a website that users enter into Web browsers in order to locate a Web page. When the user enters a URL, the browser sends an HTTP request to the server computer running Apache, usually on port 80. The HTTP protocol is the Internet standard data transfer protocol for Web pages, so when a user makes a URL request to an Apache server, the Apache server will handle the HTTP request and return the requested Web pages.

Multitasking/Multithreading

An Apache server will handle numerous HTTP requests at a single time. In order to do this, the server has to run on multiple "threads" of execution. A thread is a part of a program that branches off from the main program and runs at the same time in order to accomplish a specific task. The Apache server will create a new thread for each HTTP request that will handle fetching and returning the requested Web page. This allows Apache to serve Web pages to multiple users at the same time.

Program and File Serving

Along with Web pages, the Apache server can allow users to download files to their computers, which Apache will also handle via HTTP. These include audio files, movie files or certain documents such as Word documents or PDF. If the user requests a program file for a scripting language, such as PHP, Python or Perl, then the Apache server executes the program and sends the output of the program to the user through HTTP. However, in order to process requests for documents containing scripting languages, the Apache server must have installed the appropriate module for that language.

Apache Packages

The Apache server comes as a standalone package, as part of larger web serving programs and complete with modules to enhance its performance. A popular implementation of the Apache server is the "LAMP" (Linux, Apache, MySQL and PHP/Perl/Python) stack. This configuration packages the Apache server with its Web-serving capabilities with the MySQL database and scripting languages such as PHP in order to serve database content for updated websites such as blogs.

×