Install and Configure Apache web server in Ubuntu

The Apache web server is the most widely used web server. Approximately 65 million web servers run on Apache.
Given below are the steps to install and configure Apache web server.

Install Apache
To install from the command line, type
$sudo aptitude -r install apache
This will install Apache2 and the recommended packages for the Apache web server.

Configuring Apache
There are different locations where the files related with Apache web server are stored.

This directory contains the configuration files for the Apache2 web
Server. The primary configuration file is apache2.conf.

This directory contains local configuration directives for Apache, such as those associated with third-party or locally installed packages.

A file containing environment variables that can be set to environment used by the apache2ctl script to manage Apache2 web Server.

This directory contains available Apache2 modules and their configuration files.

This directory contains the links to enable Apache2 modules and their configuration files, located in /etc/apache2/mods-available directory.

This directory contains files that define the web sites supported by the server.

This configuration file determines whether Apache should automatically start at boot time.

This is a shell script to start and stop Apache web Server.

The actual executable for the Apache web server.

This is a shell script which simplifies starting, stopping, restarting and monitoring the status of a Apache web server.

This directory contains the Apache2 manual. This directory is present if apache2 doc package is installed.

This directory contains the default error responses delivered.

This directory contains the default set of icons used by Apache web Server.

The default log file for an Apache web server. This log file tracks any attempts to access the web site, the host that they came from and more.

A text file used by Apache to record its process ID when its starts. This file is used when terminating or restarting the Apache server using the /etc/init.d/apache2script

This directory contains the default home page for this web server. To access the default Apache web page, go to http://localhost/. Default root document for apache2 is /var/www.
To change the default root document goto /etc/apache2/sites-available/default file and look for the line DocumentRoot /var/www/. Change the path to your desired folder.
After making any changes to Apache, you need to restart it. To restart Apache, go to terminal and type
$sudo /etc/init/apache2 restart