1 / 3
Caption Text
2 / 3
Caption Two
3 / 3
Caption Three margin testing

Friday, February 5, 2010

Simple commands to manage apache2 sites and Modules

Simple commands to manage apache2 sites and Modules | Ubuntu Geek

This tutorial will explain some useful commands to manage apache2 sites and Modules
Apache2 Configuration Files Location

First we will explain what is there under /etc/apache2/ directory

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.

Commands to use

a2ensite - a2ensite is a script that enables the specified site (which contains a <VirtualHost> block) within the apache2 configuration. It does this by
creating symlinks within /etc/apache2/sites-enabled.

Example

sudo a2ensite test

Note:- Test is the file you have created under /etc/apache2/sites-enabled/ with the required configuration

a2dissite - a2dissite is a script that disables the specified site (which contains a <VirtualHost> block) within the apache2 configuration. It does this by removing symlinks within /etc/apache2/sites-enabled.

Example

sudo a2dissite test

a2enmod - a2enmod is a script that enables the specified module within the apache2 configuration. It does this by creating symlinks within /etc/apache2/mods-enabled.

Example

sudo a2enmod imagemap

Enables the mod_imagemap module

a2dismod - a2dismod is a script that disables the specified module within the apache2 configuration. It does this by removing symlinks within /etc/apache2/mods-enabled.

Example

sudo a2dismod mime_magic

Disables the mod_mime_magic module.

You can check the list of available modules under /etc/apache2/mods-available

No comments:

Post a Comment

Featured Post

Windows和Ubuntu双系统完全独立的安装方法

http://www.ubuntuhome.com/windows-and-ubuntu-install.html  | Ubuntu Home Posted by Snow on 2012/06/25 安装Windows和Ubuntu双系统时,很多人喜欢先安装windows,然...