Apache HTTP Server is a free software/open source web server for Unix-like systems, Microsoft Windows, Novell NetWare and other platforms. Apache is notable for playing a key role in the initial growth of the World Wide Web,and continues to be the most popular web server in use, serving as the de facto reference platform against which other web servers are designed and judged.
Apache features configurable error messages, DBMS-based authentication databases, and content negotiation. It is also supported by several graphical user interfaces (GUIs) which permit easier, more intuitive configuration of the server.
Apache2 installation in debian
#apt-get install apache2
This will complete the installation of apache2 web server and now you need to know where the configuration files and document root for your apache web server.
By default all your configuration files are located at /etc/apache2
Default document root for apache2 is /var/www.If you want to change the default document root you need to edit the /etc/apache2/sites-available/default file and look for this line “DocumentRoot /var/www/” here you can change where ever you want to change.For example if you want to change /home/wwww the above line looks like this “DocumentRoot /home/www/”.
The main configuration file located at /etc/apache2/apche2.conf.
Installing php and cgi support for apache2
If you want to add support of php and cgi scripts install the following packages libapache2-mod-php4,php4-cli,php4-common,php4-cgi
#apt-get install libapache2-mod-php4 php4-cli php4-common php4-cgi
This will complete the installation of php support for apache2
If you want to allow the different index files types check for the following line in /etc/apache2/apache2.conf file DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.shtml
Restart the apache server
Testing your apache Server
You can access you apache using http://yourserverip/apache2-default/ it should appear the following message
“If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page.
The worker MPM provides a threaded implementation for Apache2. It is considerably faster than the traditional model,and is the recommended MPM.You can install this using the following command.
#apt-get install apache2-mpm-prefork
Other files and folder located under /etc/apache2
Files in this directory are included by this line in apache2.conf:# Include generic snippets of statements Include
This is a good place to add additional configuration directives.
httpd.conf Empty file.
Magic data for mod_mime_magic Apache module, documented in htdocs/manual/mod/mod_mime_magic.html. You probably don’t need to touch this.
This directory contains a series of .load and .conf files.The .load files contain the Apache configuration directive necessary to load the module in question. The respective .conf files contain configuration directives necessary to utilize the module in question.
To actually enable a module for Apache2, it is necessary to create a symlink in this directory to the .load (and .conf, if it exists) files associated with the module in mods-available/.For example:cgi.load -> /etc/apache2/mods-available/cgi.load ports.conf Configuration directives for which ports and IP addresses to listen to.
Like mods-available/, except it contains configuration directives for different virtual hosts that might be used with apache2. Note that the hostname doesn’t have to correspond exactly with the filename. ‘default’ is the default host.
Similar in functionality to mods-enabled/, sites-enabled contains symlinks to sites in sites-available/ that the admnistrator wishes to enable.
Example:test -> /etc/apache2/sites-available/test
Enable and Disable modules and sites in apache2
a2enmod and a2dismod are available for enabling and disabling modules utilizing the above configuration system.
a2ensite and a2dissite have been added, which do essentially the same thing as the above tools, but for sites rather than modules.