I can see the list of core and other modules loaded by apache using the below command:
$ apache2ctl -t -D DUMP_MODULES
Loaded Modules:
core_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
auth_basic_module (shared)
auth_digest_module (shared)
In order to optimize the performance of the server (save memory on each Apache
thread essentially), I would like to disable unused modules. The Apache
documentation provides information about this modules at the following page.
Most of the time, the information provided for each module is enough to determine whether I should disable a module or not. For instance I know I don't use LDAP
authentication so I can safely disable authnz_ldap_module
.
However for some modules it is a bit less obvious. For instance the mime_magic
module is used as a "second line of defense" for cases that mod_mime
can't resolve, which can't be determined theoretically as it depends on what files will get served by Apache.
Q: Is there a way to log to a file the list of modules that Apache
effectively used to process a request?
If I could log such information, I would just let the web server run for some time, then get the list of modules that were used to process all the requests received in the meantime, and disable those that don't appear in that list.