Apache

Introduction
The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server application for modern operating systems. The goal of this project is to provide a secure, efficient and extensible web server that provides HTTP services in sync with the current HTTP standards. Note: In the rest of this article we use web server application and web server interchangeably.

Apache web server configuration
The XAMPP software solution stack contains the Apache web server; the configuration settings for Apache can be found by opening httpd.conf, located in the xampp\apache\conf folder.

Two important concepts to be aware of include document root and alias.

The document root
The document root is the directory from where a web server application serves web pages to a browser (web client application). Apache web server can be configured to handle more than one document root, each with its own path in the file system of the computer where the web server resides.

httpd.conf
In order to utilize Apache for specific needs, we need to define other directories, besides the default one, from which the server satisfies browser's requests, and set up aliases to these directories. To accomplish this, follow the next set of directions:


 * Open httpd.conf file in Notepad++ for editing.
 * Define a new directory by writing the following code after the directory definition for xampp/htdocs (typically between lines 200 and 240):

Alias
An alias is a short name for a path that starts with one of the configured document root directors. An alias is used in the URL of the web pages that reside in the document root directory.

For example, if E:/devel/web is the path for a document root, we can create an alias web that corresponds to this path by using the alias directive as folows: Alias /web E:/devel/web In this case, the URL  http://localhost/web  will be resolved as E:/devel/web directory from which the Apache web server serves web pages.

Another example. Assume that E://devel/web has a subdirectory practice: E://devel/web/practice. The subdirectory contains the codebase of a web development project (with many folders and files). Instead of using the URL  http://localhost/web/practice , we can create an alias practice as follows: Alias /practice E:/devel/web/practice and use  http://localhost/practice  to access web pages in the E:/web/devel/practice directory.

Alias Setup
To set up an alias to the document root defined at C:\devel\web: Alias /web C:/devel/web
 * Go to the module where aliases are explained.
 * Write an alias directive after the comment block that has an alias directive example. For example, write:
 * Save the httpd.conf file
 * Stop and Start the Apache server from the XAMPP control panel application.

Example
The original C:\xampp\apache\conf\httpd.conf file has two modules of interest for configuring a document root and aliases: directory module and alias_module, as follows:

 #   # Possible values for the Options directive are "None", "All", # or any combination of: #  Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews #   # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. #   # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. #   Options Indexes FollowSymLinks Includes ExecCGI
 * 1) This should be changed to whatever you set DocumentRoot to.
 * 1) This should be changed to whatever you set DocumentRoot to.

#   # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: #  Options FileInfo AuthConfig Limit #   AllowOverride All

#   # Controls who can get stuff from this server. #   Order allow,deny Allow from all



 #   # Alias: Maps web paths into filesystem paths and is used to    # access content that does not live under the DocumentRoot. # Example: # Alias /webpath /full/filesystem/path #   # If you include a trailing / on /webpath then the server will # require it to be present in the URL. You will also likely # need to provide a  section to allow access to   # the filesystem path. 

To set up a new directory root, write a new directory module below the existing one. Here is the example of how the lab computers are set up:  Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all 
 * 1) CIS admin - July 2, 2012 - New document root on the drive where xampp directory is.
 * 2) If xampp is on the C: drive, then the document root is a C: drive path.
 * 3) If xampp is on a flash drive (whatever letter), then the document root a path on that drive.
 * 1) If xampp is on a flash drive (whatever letter), then the document root a path on that drive.

To set up alternative aliases, write a new alias line following the template provided in the comment. Here is an example of how the lab computers are set up: Alias /web /devel/web Alias /cis505 /devel/web/cis505 Alias /donate /devel/web/donate
 * 1) CIS admin - July 2, 2012 - Alias directivies for new web paths mapped to filesystem paths
 * 2) Template for additional web paths:
 * 3) Alias /web-path-name /devel/web/filesystem-directory-name
 * 1) Alias /web-path-name /devel/web/filesystem-directory-name