Howto see which Modules are enabled in Apache2

If you want to see which Modules are enabled in your Apache2 config the following command will probably help you.

apache2ctl -M

In my current config this gets me the following result.

Loaded Modules:
 core_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 alias_module (shared)
 auth_basic_module (shared)
 authn_file_module (shared)
 authz_default_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 php5_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 status_module (shared)
Syntax OK

Howto enable or disable a Module in Apache2

The following commands will show you how easy it is to enable or disable a module in Apache2. For this example we play with the well known mod_rewrite Module.

Enable a Module

a2enmod rewrite

After having enabled the Module you must reload Apache with the following Command, a complete restart ist not needed.

/etc/init.d/apache2 reload

Disable a Module

a2dismod rewrite

After having enabled the Module you must reload Apache with the following Command, a complete restart ist not needed.