Debian Admin - Your way to Debian World

September 6, 2006

Apache2 installation and configuration with php support

by @ 10:20 am. Filed under Webserver

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

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

#/etc/init.d/apache2 restart

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.
Recomended module

apache2-mpm-worker

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

conf.d/

Files in this directory are included by this line in apache2.conf:# Include generic snippets of statements Include

/etc/apache2/conf.d

This is a good place to add additional configuration directives.

httpd.conf Empty file.

magic

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.

mods-available/

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.

mods-enabled/

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.

sites-available/

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.

sites-enabled/

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.

Tags: , , , ,

2 Responses to “Apache2 installation and configuration with php support”

  1. Vinay Says:

    Excellent website. I just got lucky to find an oncampus job that deals with debian. This website gives me all the transition knowledge needed for a guy who has had a Redhat background. Thank you, sir.

  2. Don Says:

    After installing Ubuntu LAMP, (downloaded) I go to a remote and log on - I get the Apache screen and I get the message that The Apache documentation has been included with this distribution and all I have to do is click the Documentation link I supposed, but this does not work and I end up with a page not found.

    What did I miss ????

Leave a Reply

Subscribe RSS Feed

subscribe to the Debian Admin RSS feed

Internal links:

Sponsors:



Categories:

Support Debian Admin

Amount $:
Website(Optional):

Sponsors:

Archives:

Related Links:


Favourite Sites:

Wordpress Collection
Windows Reference
Ubuntu Geek
DebianHelp
All About Debian Tutorials
Power Electrical
Check Your IP Here
Debian,Ubuntu News
DebCentral
Tuxmachines
Capnkirby
Libervis
Nuxifield
Linux Horizon
Linux Appfinder
Debuntu
GNU/Linux For Everyone
Free Penguin
DebianAdmin is not related to the Debian Project.
This site is copyright © 2006,2007 Debian Admin
All Trademarks are the property of their respective owners.
The contents of this website may not be mirrored or archived without the express written permission of DebianAdmin Site Owner.

DISCLAIMER: All the information, troubleshooting methods, utilities offered in this website is provided AS-IS, without any warranties. Though I strive for perfection, and always test the validity and effectiveness of the troubleshooting content in various systems, I assume no responsibility for your use of these Fixes, Utilities and other troubleshooting advice. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason. All use is completely at your own risk. Changes to the existing content and new additions are made to this website periodically, without notification.
Rodney's Kontera DynamiContext Plugin plugged in.