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.

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

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

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

/etc/apache2/mods-available
This directory contains available Apache2 modules and their configuration files.

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

/etc/apache2/sites-available
This directory contains files that define the web sites supported by the server.

/etc/default/apache2
This configuration file determines whether Apache should automatically start at boot time.

/etc/init.d/apache2
This is a shell script to start and stop Apache web Server.

/etc/sbin/apache2
The actual executable for the Apache web server.

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

/usr/share/apache2-doc
This directory contains the Apache2 manual. This directory is present if apache2 doc package is installed.

/usr/share/apache2/error
This directory contains the default error responses delivered.

/usr/share/apache2/icons
This directory contains the default set of icons used by Apache web Server.

/var/log/apache2/access.log
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.

/var/run/apache2/apache2.pid
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

/var/www/apache2-default
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      

1 comments:

Post a Comment