Apache2.2 configuration for Ubuntu (Debian type Linux)

ubuntu is a Debian type GNU Linux distribution and the configuration is different from that of RedHat type distributions such as CentOS and Fedra.

The Apache configuration differs depending on the distribution. For ubuntu, you can use a2enmod/a2dismod, and a2ensite/a2dissite commands for the settings, which allow separate management of the module and site.

The Apache directory configuration for ubuntu is as follows:

|-- apache2.conf
|-- conf.d
| `-- charset
|-- envvars
|-- httpd.conf <--- a dummy file, normally not edited.
|-- mods-available
| |-- actions.conf
| |-- actions.load
| |-- alias.conf
| |-- alias.load
| |-- asis.load
| |-- auth_basic.load
| |-- auth_digest.loadsnip| |-- userdir.load
| |-- usertrack.load
| |-- version.load
| `-- vhost_alias.load
|-- mods-enabled
| |-- alias.conf -> ../mods-available/alias.conf
| |-- php5.conf -> ../mods-available/php5.confsnip| |-- userdir.conf -> ../mods-available/userdir.conf
| `-- userdir.load -> ../mods-available/userdir.load
|-- ports.conf
|-- sites-available <--- store configuration directives for different virtual 
| | hosts. 
| |-- default 
| |---www.kndb.jp
| |---it.kndb.jp
| `-- snip)
`-- sites-enabled
    `-- 000-default -> /etc/apache2/sites-available/default

Example: Enter the following command to enable userdir module.

$>sudo a2enmod usrdir

Example: Enter the following command to disable mod_python module.

$>sudo a2dismod mod_python

When a module is enabled, its file is created under the etc/apache2/mods-enabled directory

Likewise, you can configure the settings of your sites using commands.

Create the configuration file under the etc/apache2/sites-available/ directory.

#Writable only by root or sudo.
$>sudo vim /etc/apache2/sites-available/www.kndb.co.jp

Once the site has been configured, enable the site setting by the following command.

$>sudo a2ensite www.kndb.co.jp

Now the site /etc/apache2/sites-enabled/www.kndb.jp has been created and enabled.

Config files registered in the sites-available directory are loaded in alphabetical order.

If you want to use install additional modules, install them via Aptitude.

$>sudo aptitude search PACKAGE_NAME
$>sudo aptitude install PACKAGE_NAME
This post is also available in other languages.