Keywords: apache, apache2

# Install Apache

## Table of contents

## Introduction

> The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.

> Apache has been the most popular web server on the Internet since April 1996.

> The Apache HTTP Server is a project of the Apache Software Foundation.

## Download & Unpack

Download and install Apache from http://httpd.apache.org/download.cgi.

Look for the Win32 Binary version.

## Install

When you install Apache, you'll get a prompt for Server Information. Here are the settings I've used:

Network Domain
  `localhost`
Server Name
  `localhost`
Admin Email
  `(your any email)`

I recommend you to check for All Users, on Port 80, as a Service.

### Path notes

If you choose Typical setup and `C:\apache` as your installation folder, it'll actually be installed to `C:\apache\Apache2`.

In Custom setup you can specifically choose where to install each of it's parts/sub-parts.

if you are updating from a previous version of 2.x, you will have to uninstall the old version before installing the new one.
However, Apache 2.x will play very nicely with an older Apache 1.x version.

## Starting / Stopping Apache

After installing, Apache2 will automatically start.

- The start icon in the system tray means it is running.
- The stop icon means that the Apache server monitor is running, but Apache2 hasn't started.

You can easily start | stop | restart Apache and Apache2 via that icon in your system tray.

If you get the `The requested operation has failed!` error while starting apache try the Test Configuration shortcut in the Start Menu to find the error (if the console window pops up and closes before you can read it, it means that your configuration is fine).

## Testing

Now the ultimate test to see if it's all working.

Open your browser and head to http://127.0.0.1/ or http://localhost/.

If you see the above Apache installation's test page then you have your server configured and running.

## Making Apache point to your files

1. Using a text editor open `C:\<APACHE_INSTALLATION_FOLDER>\conf\httpd.conf` (in the start-menu there should also be a Edit the Apache httpd.conf Configuration File shortcut) and search for DocumentRoot.
2. Change it from something like `DocumentRoot C:/<APACHE_INSTALLATION_FOLDER>/htdocs` to the location where your HTML files are located (e.g. `DocumentRoot C:/public_html`).
3. Then scroll down about one page and change `<Directory "C:/<APACHE_INSTALLATION_FOLDER>/htdocs">` to point to the same location you set DocumentRoot to in the last step.
4. Restart apache so the changes take effect.