Adding Modules to Apache in Ubuntu 9.10

by Mike on December 16, 2009 · 1 comment

in Ubuntu Servers

Modules allow Apache to expand the capabilities that it has by using modules. Modules use the Multi-Processing Module (MPM) to create a child process to expand into a new module. These modules allow not only Apache to expand but it also speeds up aspects that Apache expands into because they are loaded in memory. An example would be when Apache loads SSL or PHP as a module. These features provide additional capabilities for Apache as they are loaded into memory. Often these modules can be unloaded when the feature is no longer needed, thus giving back valuable memory. The other valuable feature in this is that the administrator can add and subtract features without recompiling.
The use of loadable modules to enable optional features is one of the nice things about Apache.  This makes memory management much more efficient than it would be if all of these features were compiled in with the Apache code.  This way, if you need a certain feature, just enable the module that goes with it.  If you don’t need the feature anymore, just use the “a2dismod” command to disable the module, restart Apache, and the memory that that module had used will be released for other purposes.

If you look in the /etc/apache2/mods-available directory, you’ll see that there are a lot of other modules that do come with Apache.  Not all of them are enabled.

actions.conf              dav_fs.load            mime_magic.load
actions.load              dav.load               negotiation.conf
alias.conf                dav_lock.load          negotiation.load
alias.load                dbd.load               php5.conf
asis.load                 deflate.conf           php5.load
auth_basic.load           deflate.load           proxy_ajp.load
auth_digest.load          dir.conf                   proxy_balancer.load
authn_alias.load          dir.load                   proxy.conf
authn_anon.load           disk_cache.conf        proxy_connect.load
authn_dbd.load            disk_cache.load        proxy_ftp.load
authn_dbm.load            dump_io.load           proxy_http.load
authn_default.load        env.load               proxy.load
authn_file.load           expires.load           rewrite.load
authnz_ldap.load          ext_filter.load        setenvif.conf
authz_dbm.load            file_cache.load        setenvif.load
authz_default.load        filter.load                speling.load
authz_groupfile.load      headers.load           ssl.conf
authz_host.load           ident.load             ssl.load
authz_owner.load          imagemap.load          status.conf
authz_user.load           include.load           status.load
autoindex.conf            info.conf                  substitute.load
autoindex.load            info.load                  suexec.load
cache.load                ldap.load              unique_id.load
cern_meta.load            log_forensic.load      userdir.conf
cgid.conf                 mem_cache.conf         userdir.load
cgid.load                 mem_cache.load         usertrack.load
cgi.load                  mime.conf              version.load
charset_lite.load         mime.load              vhost_alias.load
dav_fs.conf               mime_magic.conf

You can enable these modules using the “a2enmod” command.  In fact, here are some modules that you’ll want to enable as soon as you install Apache:

sudo a2enmod ssl
Module ssl installed; run /etc/init.d/apache2 force-reload to enable.
sudo a2enmod rewrite
Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.
sudo a2enmod suexec
Module suexec installed; run /etc/init.d/apache2 force-reload to enable.
sudo a2enmod include
Module include installed; run /etc/init.d/apache2 force-reload to enable.

When you’re finished enabling the modules that you want, you’ll need to perform a “force-reload” of Apache:

sudo service apache2 restart
* Forcing reload of apache 2.0 web server…                                             [ ok ]

Now, when you look in the “/etc/apache2/mod-enabled” directory, you’ll see the following:

auth_mysql.load  include.load  php5.load     ssl.conf  suexec.load   userdir.load
cgi.load         php5.conf     rewrite.load  ssl.load  userdir.conf

Previous post:

Next post: