a2enmod is a command in Ubuntu that is used to enable Apache HTTP Server modules. It is part of the apache2-utils package, which provides utility programs for the Apache HTTP Server.
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.
If you encounter the below error while running the a2enmod command:
a2enmod: command not found
you may try installing the below package as per your choice of distribution:
OS Distribution | Command |
---|---|
Debian | apt-get install apache2 |
Ubuntu | apt-get install apache2 |
Alpine | apk add apache2 |
Kali Linux | apt-get install apache2 |
Raspbian | apt-get install apache2 |
a2enmod Command Examples
1. Enable a module:
$ sudo a2enmod {{module}}
2. Don’t show informative messages:
$ sudo a2enmod --quiet {{module}}