Posted by chris on Mon 8 Aug 2005 at 20:17
This brief introduction for configuring sites and modules in Debian's Apache 2 package explains how to add and remove sites using the supplied tools, along with adding and removing modules.
The main source of confusiong comes from the various directories stored beneath /etc/apache2:
- sites-available
- A list of configuration files - one per site. A blank install will contain the file default. The system admin can have as many sites here as they need - however - they will not all be active.
- sites-enabled
- A list of symlinks to configuration files in sites-available. A blank install will contain a symlink 000default to sites-available/default. The sites listed here are the sites which will be active. The site to be used if no virtual hosts match will be the first file found (hence the 000 on 000default).
- mods-available
- A list of configuration files - one or more per module. Each dpkg installed module will add files here. e.g. php4.conf and php4.load are added with the libapache2-mod-php package. Again - the system admin can install whatever modules they wish - however - until they are set available they will not be active.
- mods-enabled
- A list of symlinks to configuratioon files in modes-available. Only modules linked in here will be activated on the webserver.
Now - several discussions on #debian IRC channel on freenode recently have had people advising others to either copy files from the available to the enabled directories or to manually symlink them. The user has, however, a better option - the four commands a2ensite, a2dissite, a2enmod and a2dismod
- a2ensite
- Will create the correct symlinks in sites-enabled to allow the site configured in sitefilename to be served
- a2dissite
- Will remove the symlinks from sites-enabled so that the site configured in sitefilename will not be served
- a2enmod
- e.g. a2enmod php4 will create the correct symlinks in mods-enabled to allow the module to be used. In this example it will link both php4.conf and php4.load for the user
- a2dismod
- Will remove the symlinks from mods-enabled so that the module cannot be used
We covered these this new layout briefly when discussing the upgrade from Apache 1.x to 2.x, and again when dicussing how to enable mod_rewrite for Apache.
This article can be found online at the Debian Administration website at the following bookmarkable URL (along with associated comments):
This article is copyright 2005 chris - please ask for permission to republish or translate.