Linux Commands Examples

A great documentation place for Linux commands

a2ensite

enable or disable an apache2 site / virtual host


see also : apache2ctl

Synopsis

a2ensite [site]

a2dissite [site]


add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!

examples

2
source
            
a2dissite vhost && a2ensite vhost && service apache2 reload
1

a2dissite default

Disables the default site.


1
source
            
a2enmod shib2
a2ensite default-shib
1
source
            
a2dissite default
a2ensite jenkins
0
source
            
for f in `ls /home/`
do
a2ensite $f
read
done
/etc/init.d/apache2 reload
0
source
            
export alias ensite='sudo a2ensite '
export alias dissite='sudo a2ensite '
export alias enmod='sudo a2enmod '
export alias dismod='sudo a2enmod '
export alias a2ensite='sudo a2ensite '
export alias a2enmod='sudo a2enmod '
export alias restart_apache='sudo apachectl restart'
0
source
            
sudo touch /var/run/mysqld/mysqld.sock
sudo a2ensite default
/etc/init.d/apache2 reload
0
source
            
if ! type a2ensite &> /dev/null; then
echo "post-domain-enable/apache2: 'a2ensite' was not found or does not exist" >&2
elif ! a2ensite "$OZ_DOMAIN_NAME" > /dev/null; then
echo "post-domain-enable/apache2: failed to enable domain '$OZ_DOMAIN_NAME'" >&2

description

This manual page documents briefly the a2ensite and a2dissite commands.

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. Likewise, a2dissite disables a site by removing those symlinks. It is not an error to enable a site which is already enabled, or to disable one which is already disabled.

The default site is handled specially: The resulting symlink will be called 000-default in order to be loaded first.

files

/etc/apache2/sites-available

Directory with files giving information on available sites.

/etc/apache2/sites-enabled

Directory with links to the files in sites-available for enabled sites.


see also

apache2ctl .


author

This manual page was written by Stefan Fritsch <sf[:at:]debian[:dot:]org> (based on the a2enmod manual page by Daniel Stone <daniel[:at:]sfarc[:dot:]net>) for the Debian GNU/Linux distribution.

How can this site be more helpful to YOU ?


give  feedback