a2ensite
Enable Apache website configuration
TLDR
Enable a virtual host
Don't show informative messages
SYNOPSIS
a2ensite site_name
PARAMETERS
site_name
The name of the configuration file (without the '.conf' extension, if present) located in the /etc/apache2/sites-available/
directory that you want to enable.
-q
Quiet mode; suppress all output except error messages.
-p
Include the site configuration file in the Apache configuration by including it directly instead of creating a symlink. This option requires Apache version 2.4.7 or later.
-n
No-act mode. Just show what would be done, but don't actually do it.
DESCRIPTION
The a2ensite
command is a utility in Debian-based Linux distributions (like Ubuntu) specifically designed to enable website configurations within the Apache web server. It works by creating symbolic links from the /etc/apache2/sites-available/
directory, which contains the configuration files for individual websites or virtual hosts, to the /etc/apache2/sites-enabled/
directory. Apache only loads configurations found in the sites-enabled
directory. This separation allows administrators to easily manage and enable/disable websites without directly modifying the core Apache configuration files.
The command simplifies the process of activating a website by handling the necessary symbolic link creation. This prevents manual errors and streamlines server administration tasks. After enabling a site using a2ensite
, you must typically restart or reload the Apache web server for the changes to take effect. The corresponding command for disabling sites is a2dissite
.
CAVEATS
The a2ensite
command is specific to Apache web server configurations on Debian-based systems. It might not exist or function identically on other Linux distributions or with other web servers.
<B>PERMISSIONS</B>
You typically need root privileges (using sudo
) to execute a2ensite
, as it modifies system-level configuration files.
<B>CONFIGURATION FILE NAMING</B>
While the a2ensite
command usually omits the '.conf' extension when specifying the site name, it's important that the actual file in /etc/apache2/sites-available/
has the '.conf' extension. Otherwise, apache can not find the configuration file.
<B>RESTARTING APACHE</B>
After using a2ensite
, remember to restart or reload Apache for the changes to take effect. Common commands for this are sudo systemctl restart apache2
or sudo apachectl graceful
.
HISTORY
The a2ensite
command was developed as part of the Apache2 infrastructure on Debian-based systems to simplify the management of virtual host configurations. It has been a standard tool for Apache server administration on these systems for many years, evolving to include additional features and options over time.