Apache2 is a most popular web server used in Linux operating systems. Apache is a modular web server where each functionality is served by specific modules. To add or remove any specific functionality to the Apache server we can simply enable or disable the corresponding module.

Advertisement

All the Apache2 modules are stored under /etc/apache2/mods-available/ directory. Once we enable any module it makes a soft link to /etc/apache2/mods-enabled/ directory. The same process reverses, once we disable any module.

In this tutorial, you will learn about enabling and disabling Apache2 modules on Debian-based systems.

1. Enable Apache2 Module

We use a2enmod command to enable modules in Apache2 web server. For example, if we need to enable the Apache rewrite module use the following command.

sudo a2enmod rewrite 

Then reload the Apache configuration.

sudo systemctl relaod apache2 

2. Disable Apache2 Module

Similarly to disable module we use a2dismod command. For example, if we need to disable the Apache rewrite module use the following command.

sudo a2dismod rewrite 

Then reload the Apache configuration.

sudo systemctl relaod apache2 

3. Check Modules Status

Check the status of the specific module using the a2query command. For example to find the current status of the rewrite module run the below command.

sudo a2query -m rewrite 
Output
rewrite (enabled by site administrator)

4. List Apache2 Modules

To list all available Apache2 modules with the status, use the following command. The output will differ system to system.

sudo a2query -m 
Output
autoindex (enabled by maintainer script) mpm_prefork (enabled by maintainer script) authn_file (enabled by maintainer script) proxy (enabled by site administrator) authz_svn (enabled by maintainer script) dav (enabled by maintainer script) ... ... dav_svn (enabled by maintainer script) proxy_http (enabled by site administrator) authz_user (enabled by maintainer script) filter (enabled by maintainer script) access_compat (enabled by maintainer script) setenvif (enabled by maintainer script)

That’s it. Assuming this tutorial gives you little understanding about modules management in Apache2 web server.

Share.

4 Comments

  1. On Ubuntu17.10, I loaded apache2, php5, MySQL, and Moodle…. Within the network things work just fine…. Externally traffic is not getting to the apache server… Internally the ipaddress will pull up the Moodle pages…. Localhost does not nor does the FQDN internally or externally. One tech thought it might be the url rewrite, or the mod_dir… but I am not sure… It is pulling up by the IP just fine internally, but not externally.

Leave A Reply

Exit mobile version