a2enmod is a command used to enable Apache HTTP Server modules on a Linux system. It stands for “Apache 2 Enable Module” and is part of the Apache HTTP Server package.
To use a2enmod, you must have administrative privileges on the system. The syntax for the command is:
a2enmod [options] module-name
Where module-name is the name of the module you want to enable.
For example, to enable the rewrite module, you would run the following command:
$ sudo a2enmod rewrite
This will create a symbolic link from the module file to the /etc/apache2/mods-enabled directory, which tells Apache to load the module when it starts up.
You can also use a2enmod to disable a module by using the -d option. For example, to disable the rewrite module, you would run the following command:
$ sudo a2enmod -d rewrite
This will remove the symbolic link from the /etc/apache2/mods-enabled directory, effectively disabling the module.
a2enmod Command Examples
1. Enable a module:
$ sudo a2enmod {{module}}
2. Don’t show informative messages:
$ sudo a2enmod --quiet {{module}}
3. To enable multiple modules at once, you can specify them as arguments to the a2enmod command, separated by spaces. For example, to enable the mod_rewrite and mod_ssl modules, you can use the following command:
$ sudo a2enmod rewrite ssl