Maintaining apache2 sites and modules lists
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:
- 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.
- 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).
- 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.
- 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
- Will create the correct symlinks in sites-enabled to allow the site configured in sitefilename to be served
- Will remove the symlinks from sites-enabled so that the site configured in sitefilename will not be served
- 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
- Will remove the symlinks from mods-enabled so that the module cannot be used