Apache2 on ubuntu comes up with different configuration. you can find all configuration files on /etc/apache2.
There are some folder/file that we need to understand if we want to enable virtual hosting and enable non-default module on apache2. Here they are:
1. Folder / Directory
sites-available
this is the folder where you store you site configuration. by name based vitual hosting means you can have different domain for your ip address. example caleudum.com and cool.com, so you will have two different file configuration inside this folder. No rule to name each configuration file. You can view sample from “default” files.
sites-enable
this is the folder that stores symlink (symbolic link) from configuration files. any site whose configuration file is stored here as symlink is enabled, means you can browse the site.
mods-availabe
this folder stores configuration files for apache modules, this configuration files is provided in .conf and .load files. .conf contains the location of modules, .conf contains the command used by apache to load the module.
mods-enable
same as sites-enable, it stores symlinks from configuration files inside mods-available. any module with configuration files symlinked here is active/enabled.
2. Command
apache2 installation gives us 4 command to enable and disable site and module, so that we dont need to create symlink manually. each of this command will create the symlink for us.
a2ensite : enable site. enter command with name of the site configuration file ex : a2ensite caleudum
a2dissite : disable site. enter command with name of the site configuration file ex : a2dissite caleudum
a2enmod : enable mod. enter command with name of the site configuration file ex : a2enmod passenger
a2dismod : disable site. enter command with name of the site configuration file ex : a2dismod passenger